:root {
  color-scheme: dark;
  --bg: #0d0d13;
  --panel: #171720;
  --panel-2: #20202b;
  --line: #333342;
  --text: #f7f4ec;
  --muted: #aaa7b6;
  --accent: #cfff62;
  --accent-2: #92e5ff;
  --danger: #ff7991;
  --shadow: 0 18px 50px rgba(0,0,0,.42);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% -10%, rgba(207,255,98,.12), transparent 32%),
    radial-gradient(circle at 110% 18%, rgba(146,229,255,.10), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; }
button { touch-action: manipulation; }

.app-shell {
  width: min(100%, 720px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 14px calc(92px + var(--safe-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 2px 10px;
}
.eyebrow, .section-kicker {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
}
h1 { margin: 0; font-size: clamp(22px, 6vw, 30px); letter-spacing: -.04em; }
h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }

.icon-button,
.step-page-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  font-weight: 900;
}

.transport {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0,1fr) 82px;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(23,23,32,.93);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.transport-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.primary-action, .secondary-action, .small-button, .danger-button {
  min-height: 44px;
  border-radius: 12px;
  padding: 0 13px;
  font-weight: 800;
}
.primary-action { border: 0; background: var(--accent); color: #171b0d; }
.primary-action.compact { min-height: 40px; }
.secondary-action, .small-button { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.small-button { min-height: 38px; }
.danger-button { border: 1px solid rgba(255,121,145,.45); background: rgba(255,121,145,.12); color: #ffacbb; }
.compact-field { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.compact-field input[type="number"] {
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101017;
  color: var(--text);
  text-align: center;
  font-weight: 800;
}
.corruption-field { grid-column: 1 / -1; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.tab-panel { display: none; padding: 22px 0 8px; }
.tab-panel.active { display: block; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-note { margin: -4px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.55; }

.track-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.track-strip::-webkit-scrollbar { display: none; }
.track-chip {
  flex: 0 0 auto;
  min-width: 92px;
  max-width: 150px;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  scroll-snap-align: start;
}
.track-chip.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.track-chip strong, .track-chip span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-chip span { color: var(--muted); font-size: 10px; margin-top: 2px; }
.track-chip.muted { opacity: .45; }

.page-toolbar {
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  align-items: center;
  gap: 10px;
  margin: 7px 0 10px;
  text-align: center;
}
.page-toolbar strong, .page-toolbar span { display: block; }
.page-toolbar strong { font-size: 15px; }
.page-toolbar span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.step-page-button { font-size: 30px; }

.step-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 8px;
}
.step-cell {
  position: relative;
  min-height: 78px;
  padding: 10px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, #1b1b25, #121219);
  color: var(--text);
  text-align: center;
}
.step-cell.beat-start { border-color: #56566a; }
.step-cell.active-step { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.step-cell.has-event { background: linear-gradient(145deg, rgba(207,255,98,.20), rgba(24,28,18,.98)); border-color: rgba(207,255,98,.48); }
.step-number { position: absolute; top: 6px; left: 7px; color: var(--muted); font-size: 9px; font-weight: 800; }
.step-note { display: block; margin-top: 16px; font-size: 18px; font-weight: 900; letter-spacing: -.03em; }
.step-sub { display: block; color: var(--muted); font-size: 9px; margin-top: 4px; }
.length-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
}
.length-control span, .length-control strong { display: block; }
.length-control span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.length-control strong { margin-top: 2px; font-size: 15px; }
.length-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 150px; }
.length-buttons button { min-height: 42px; }
.sequence-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }

.track-list { display: grid; gap: 10px; }
.track-row {
  display: grid;
  grid-template-columns: 46px minmax(0,1fr);
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.track-row.selected { border-color: var(--accent); }
.track-index { display: grid; place-items: center; border-radius: 12px; background: #0f0f15; color: var(--accent); font-weight: 900; }
.track-row-main { min-width: 0; }
.track-row-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.track-row-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-type-label { flex: 0 0 auto; padding: 4px 7px; border-radius: 99px; background: rgba(146,229,255,.1); color: var(--accent-2); font-size: 9px; font-weight: 800; }
.track-row-actions { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 6px; margin-top: 9px; }
.track-row-actions button { min-height: 37px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); font-size: 12px; }
.track-row-actions button.on { color: var(--accent); border-color: rgba(207,255,98,.5); }

.settings-card {
  display: grid;
  gap: 15px;
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
}
.field { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.field input[type="text"], .field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: #101017;
  color: var(--text);
}
.inline-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hidden { display: none !important; }

.export-button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 64px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, #232330, #17171f);
  color: var(--text);
  text-align: left;
}
.export-button strong { font-size: 15px; }
.export-button span { color: var(--muted); font-size: 11px; }
.status-card { padding: 13px; border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); font-size: 12px; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 720px);
  padding: 8px 10px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(13,13,19,.95);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}
.nav-button {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-height: 51px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.nav-button span { font-size: 20px; }
.nav-button.active { background: rgba(207,255,98,.1); color: var(--accent); }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,.64);
}
.bottom-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 60;
  width: min(100%, 720px);
  max-height: 82dvh;
  overflow-y: auto;
  padding: 8px 15px calc(18px + var(--safe-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: #171720;
  box-shadow: 0 -22px 60px rgba(0,0,0,.55);
  transform: translate(-50%, 105%);
  transition: transform .22s ease;
}
.bottom-sheet.open { transform: translate(-50%, 0); }
.sheet-handle { width: 50px; height: 5px; margin: 0 auto 10px; border-radius: 99px; background: #4e4e5d; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.octave-control { display: grid; grid-template-columns: 50px 1fr 50px; gap: 9px; align-items: center; margin-bottom: 13px; }
.octave-control strong { text-align: center; }
.octave-control button { min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); font-size: 22px; }
.note-key-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.note-key-grid button { min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: #22222d; color: var(--text); font-weight: 900; }
.note-key-grid button.accidental { background: #0e0e14; color: var(--accent-2); }
.note-key-grid button.selected { border-color: var(--accent); background: rgba(207,255,98,.17); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(207,255,98,.22); }
.chord-selection-card { margin-bottom: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 14px; background: #101017; }
.chord-selection-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.chord-selection-head strong { color: var(--text); font-size: 13px; }
.selected-note-list { display: flex; flex-wrap: wrap; gap: 7px; min-height: 35px; margin-top: 9px; }
.selected-note-list:empty::before { content: "音をタップして追加"; color: var(--muted); font-size: 12px; align-self: center; }
.selected-note-chip { min-height: 34px; padding: 0 10px; border: 1px solid rgba(207,255,98,.45); border-radius: 99px; background: rgba(207,255,98,.1); color: var(--accent); font-weight: 900; }
.chord-tools { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.chord-tools p { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.chord-preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.chord-preset-grid button, .chord-inversion-grid button { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font-weight: 800; }
.chord-inversion-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 7px; }
.sheet-actions.three-actions { grid-template-columns: 1fr 1fr 1fr; }
.step-cell.is-chord .step-note { color: var(--accent); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.drum-trigger-button, .type-card {
  width: 100%;
  min-height: 76px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px;
  background: var(--panel-2);
  color: var(--text);
}
.type-card { display: grid; gap: 4px; text-align: left; }
.type-card strong { font-size: 17px; }
.type-card span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.help-copy { color: #d9d6df; font-size: 14px; line-height: 1.75; }
.help-copy .caution { color: var(--accent-2); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  z-index: 100;
  max-width: calc(100% - 30px);
  padding: 10px 14px;
  border-radius: 99px;
  background: #f4f1e8;
  color: #13131a;
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: .18s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 620px) {
  .app-shell { padding-left: 24px; padding-right: 24px; }
  .transport { grid-template-columns: 320px 90px 1fr; }
  .corruption-field { grid-column: auto; }
  .step-grid { grid-template-columns: repeat(8, minmax(0,1fr)); }
  .step-cell { min-height: 82px; }
}

@media (max-width: 370px) {
  .app-shell { padding-left: 9px; padding-right: 9px; }
  .transport { gap: 7px; padding: 8px; }
  .primary-action, .secondary-action { padding-left: 8px; padding-right: 8px; font-size: 12px; }
  .step-grid { gap: 6px; }
  .step-cell { min-height: 70px; padding-left: 4px; padding-right: 4px; }
  .step-note { font-size: 16px; }
}

/* 0.3α：小節・tickイベント編集 */
.score-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 4px 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
}
.compact-select-field { gap: 5px; }
.compact-select-field select,
.duration-card select,
.duration-card input[type="number"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 10px;
  background: #101017;
  color: var(--text);
  font-weight: 800;
}
.time-signature-control {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
}
.time-signature-control strong { color: var(--muted); text-align: center; }
.step-cell.is-sustain {
  border-style: dashed;
  border-color: rgba(146,229,255,.45);
  background: linear-gradient(145deg, rgba(146,229,255,.10), rgba(18,18,25,.98));
}
.step-cell.is-sustain .step-note { color: var(--accent-2); }
.step-cell.partial-cell { opacity: .62; }
.step-cell .step-position {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
}
.event-position-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.duration-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 9px;
  margin-bottom: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #101017;
}
.duration-card p {
  grid-column: 1 / -1;
  margin: -1px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.duration-tick-field input { text-align: center; }
.step-cell.has-event .step-sub { color: #dfeabf; }
.step-grid[data-cell-count="1"],
.step-grid[data-cell-count="2"],
.step-grid[data-cell-count="3"],
.step-grid[data-cell-count="4"] { grid-template-columns: repeat(4, minmax(0,1fr)); }

@media (max-width: 370px) {
  .score-controls { gap: 6px; padding: 8px; }
  .compact-select-field select { padding: 0 6px; font-size: 12px; }
  .duration-card { grid-template-columns: 1fr 105px; padding: 9px; }
}

/* Header menu */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.menu-button { padding: 0; }
.hamburger-icon { display: grid; gap: 4px; width: 19px; }
.hamburger-icon i { display: block; width: 100%; height: 2px; border-radius: 99px; background: currentColor; }

/* Right-side menu drawer */
.menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(91vw, 430px);
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(28px + var(--safe-bottom));
  border-left: 1px solid var(--line);
  background:
    radial-gradient(circle at 90% 0%, rgba(207,255,98,.11), transparent 28%),
    #15151e;
  box-shadow: -22px 0 60px rgba(0,0,0,.5);
  transform: translateX(105%);
  transition: transform .22s ease;
}
.menu-drawer.open { transform: translateX(0); }
.menu-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.menu-help-button {
  display: grid;
  grid-template-columns: 46px minmax(0,1fr);
  align-items: center;
  gap: 2px 11px;
  width: 100%;
  min-height: 70px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(146,229,255,.35);
  border-radius: 16px;
  background: rgba(146,229,255,.08);
  color: var(--text);
  text-align: left;
}
.menu-help-button > span { grid-row: 1 / 3; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--accent-2); color: #0d1a20; font-size: 22px; font-weight: 950; }
.menu-help-button strong { align-self: end; font-size: 15px; }
.menu-help-button small { align-self: start; color: var(--muted); font-size: 10px; line-height: 1.4; }
.menu-section {
  margin-top: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(31,31,42,.88);
}
.menu-section-label { margin: 0 0 5px !important; color: var(--accent); font-size: 9px !important; font-weight: 900; letter-spacing: .16em; }
.menu-section h3 { margin: 0 0 9px; font-size: 17px; letter-spacing: -.02em; }
.menu-section p { margin: 8px 0 0; color: #d9d6df; font-size: 12px; line-height: 1.72; }
.menu-section strong { color: var(--text); }
.menu-caution { padding: 10px; border-left: 3px solid var(--accent-2); border-radius: 4px 10px 10px 4px; background: rgba(146,229,255,.07); color: #c7dce3 !important; font-size: 11px !important; }
.menu-link-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  margin-top: 12px;
  padding: 0 12px;
  border: 1px solid rgba(207,255,98,.35);
  border-radius: 12px;
  background: rgba(207,255,98,.08);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
}
.menu-link-button strong { color: var(--accent); }
.story-section { background: linear-gradient(145deg, rgba(77,32,48,.37), rgba(28,27,38,.94)); }
.story-links { display: grid; gap: 8px; margin-top: 12px; }
.story-links a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 0 12px; border: 1px solid rgba(255,255,255,.10); border-radius: 12px; background: rgba(0,0,0,.18); color: var(--text); text-decoration: none; font-size: 12px; }
.story-links a strong { color: #ffc7d5; }
.support-section { text-align: center; }
.support-section h3, .support-section p { text-align: left; }
.bmc-button { display: inline-block; margin-top: 14px; line-height: 0; }
.bmc-button img { display: block; width: 217px; max-width: 100%; height: auto; min-height: 60px; margin: 0 auto; border: 0; }
.data-note-section { background: rgba(18,25,31,.92); }
.menu-footer { padding: 22px 8px 4px; text-align: center; }
.menu-footer p { margin: 0; color: var(--text); font-size: 12px; font-weight: 800; }
.menu-footer span { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }

/* Expanded help */
.help-sheet { max-height: 90dvh; }
.help-copy { display: grid; gap: 9px; }
.help-lead { padding: 13px; border: 1px solid rgba(207,255,98,.25); border-radius: 15px; background: rgba(207,255,98,.07); }
.help-lead strong { color: var(--text); font-size: 14px; line-height: 1.6; }
.help-lead p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.help-copy details { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #111118; }
.help-copy summary { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 10px 13px; color: var(--text); font-size: 13px; font-weight: 850; cursor: pointer; list-style: none; }
.help-copy summary::-webkit-details-marker { display: none; }
.help-copy summary::after { content: "＋"; margin-left: auto; color: var(--accent); font-size: 18px; }
.help-copy details[open] summary::after { content: "−"; }
.help-copy summary span { display: grid; place-items: center; flex: 0 0 auto; width: 29px; height: 29px; border-radius: 9px; background: rgba(207,255,98,.11); color: var(--accent); font-size: 10px; }
.help-detail-body { padding: 0 14px 14px; border-top: 1px solid var(--line); color: #d9d6df; font-size: 12px; line-height: 1.75; }
.help-detail-body p { margin: 12px 0 0; }
.help-detail-body ul, .help-detail-body ol { margin: 10px 0 0; padding-left: 21px; }
.help-detail-body li + li { margin-top: 6px; }
.help-detail-body strong { color: var(--text); }
.help-table-wrap { overflow-x: auto; margin-top: 11px; }
.help-table { width: 100%; min-width: 360px; border-collapse: collapse; font-size: 11px; }
.help-table th, .help-table td { padding: 8px; border: 1px solid var(--line); text-align: left; }
.help-table th { background: #20202b; color: var(--accent-2); }
.help-code { overflow-x: auto; margin-top: 11px; padding: 11px; border: 1px solid #303044; border-radius: 11px; background: #09090e; color: #d5ff8a; font-size: 11px; line-height: 1.7; white-space: nowrap; }
.help-limitations { padding: 13px; border: 1px solid rgba(255,121,145,.28); border-radius: 15px; background: rgba(255,121,145,.06); }
.help-limitations strong { color: #ffacbb; }
.help-limitations p { margin: 6px 0 0; color: #d7c6ca; font-size: 11px; line-height: 1.65; }

@media (max-width: 370px) {
  .topbar-actions { gap: 5px; }
  .icon-button, .step-page-button { width: 40px; height: 40px; }
  .menu-drawer { width: 94vw; padding-left: 12px; padding-right: 12px; }
}



/* 0.4α：イベント音程表情 */
.sound-subsection {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(146,229,255,.24);
  border-radius: 14px;
  background: rgba(146,229,255,.055);
}
.sound-subsection-head { display: grid; gap: 3px; }
.sound-subsection-head strong { color: var(--text); font-size: 13px; }
.sound-subsection-head span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.sound-subsection input[type="number"],
.expression-card input[type="number"],
.expression-card select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 10px;
  background: #101017;
  color: var(--text);
  font-weight: 800;
}
.expression-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #101017;
  overflow: hidden;
}
.expression-card summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 13px;
  cursor: pointer;
  color: var(--text);
  font-weight: 900;
  list-style: none;
}
.expression-card summary::-webkit-details-marker { display: none; }
.expression-card summary span { color: var(--accent-2); font-size: 11px; font-weight: 800; }
.expression-card[open] summary { border-bottom: 1px solid var(--line); }
.expression-body { display: grid; gap: 12px; padding: 13px; }
.expression-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.expression-preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.expression-preset-grid button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}
.expression-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.expression-grid.is-disabled { opacity: .42; pointer-events: none; }
.expression-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  min-width: 22px;
  padding: 2px 4px;
  border-radius: 99px;
  background: rgba(146,229,255,.15);
  color: var(--accent-2);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .04em;
}
.step-cell.has-expression { box-shadow: inset 0 0 0 1px rgba(146,229,255,.28); }
@media (max-width: 370px) {
  .expression-grid { grid-template-columns: 1fr; }
  .expression-body { padding: 10px; }
}


/* 0.5α：リズム隊・ミックス強化 */
.field-note { color: var(--muted); font-size: 10px; line-height: 1.5; font-weight: 600; }
.mix-settings-card { border-color: rgba(255,190,91,.28); background: linear-gradient(145deg, rgba(60,40,18,.18), rgba(22,22,29,.94)); }
.mix-settings-card .sound-subsection-head { padding-bottom: 2px; }
.mix-note { margin: 0; padding: 10px; border: 1px solid rgba(255,190,91,.22); border-radius: 11px; background: rgba(255,190,91,.055); color: var(--muted); font-size: 10px; line-height: 1.65; }


/* Composite triplet grid/editor */
.step-cell.triplet-cell {
  min-height: 94px;
  padding: 9px 6px 7px;
}
.triplet-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 15px;
}
.triplet-preview-slot {
  min-width: 0;
  min-height: 43px;
  padding: 5px 2px 3px;
  border: 1px solid #363644;
  border-radius: 9px;
  background: rgba(255,255,255,.025);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.triplet-preview-slot.has-note {
  border-color: rgba(207,255,98,.42);
  background: rgba(207,255,98,.09);
  color: var(--accent);
}
.triplet-preview-slot.is-sustain {
  border-style: dashed;
  border-color: rgba(146,229,255,.45);
  color: var(--accent-2);
}
.triplet-preview-slot.is-rest { color: #777786; }
.triplet-preview-slot.is-partial { opacity: .35; }
.triplet-preview-index { font-size: 8px; color: var(--muted); font-weight: 800; }
.triplet-preview-note {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 900;
}
.triplet-cell-label { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.triplet-offgrid-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  padding: 2px 5px;
  border-radius: 99px;
  background: rgba(255,178,92,.17);
  color: #ffc17a;
  font-size: 8px;
  font-weight: 900;
}
.triplet-editor-card {
  margin-bottom: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #101017;
}
.triplet-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}
.triplet-editor-head strong { font-size: 14px; }
.triplet-editor-head span { color: var(--muted); font-size: 10px; text-align: right; }
.triplet-editor-card p { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.triplet-slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; }
.triplet-slot-button {
  min-width: 0;
  min-height: 68px;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
}
.triplet-slot-button.selected {
  border-color: var(--accent);
  background: rgba(207,255,98,.13);
  box-shadow: inset 0 0 0 1px rgba(207,255,98,.18);
}
.triplet-slot-button.has-note strong { color: var(--accent); }
.triplet-slot-button.is-sustain strong { color: var(--accent-2); }
.triplet-slot-button:disabled { opacity: .35; }
.triplet-slot-button span, .triplet-slot-button strong, .triplet-slot-button small { display: block; }
.triplet-slot-button span { color: var(--muted); font-size: 9px; font-weight: 900; }
.triplet-slot-button strong { margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.triplet-slot-button small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.triplet-rest-button {
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  border: 1px solid rgba(255,116,135,.38);
  border-radius: 12px;
  background: rgba(255,116,135,.09);
  color: #ff9cab;
  font-weight: 900;
}
.triplet-rest-button:disabled { opacity: .45; }
@media (max-width: 370px) {
  .step-cell.triplet-cell { min-height: 88px; padding-left: 4px; padding-right: 4px; }
  .triplet-preview { gap: 2px; }
  .triplet-preview-slot { min-height: 39px; }
  .triplet-preview-note { font-size: 10px; }
}

/* Inline triplet selector: hidden until selected */
.event-input-mode-card {
  margin-bottom: 12px;
  padding: 11px;
  border: 1px solid rgba(146,229,255,.28);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(34,48,58,.28), rgba(20,20,28,.96));
}
.event-input-mode-card p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.triplet-conflict-note {
  margin: 9px 0 0;
  padding: 8px 9px;
  border: 1px solid rgba(255,178,92,.34);
  border-radius: 10px;
  background: rgba(255,178,92,.08);
  color: #ffc17a;
  font-size: 10px;
  line-height: 1.5;
}
.triplet-continuation-cell .step-note { color: var(--accent-2); font-size: 15px; }

/* Triplet tie / per-slot duration controls */
.triplet-slot-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}
.triplet-slot-mode-grid button {
  min-width: 0;
  min-height: 44px;
  padding: 7px 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.triplet-slot-mode-grid button.selected {
  border-color: var(--accent);
  background: rgba(207,255,98,.13);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(207,255,98,.16);
}
#tripletContinueButton.selected {
  border-color: rgba(146,229,255,.62);
  background: rgba(146,229,255,.11);
  color: var(--accent-2);
}
#tripletRestButton.selected {
  border-color: rgba(255,116,135,.52);
  background: rgba(255,116,135,.09);
  color: #ff9cab;
}
.triplet-duration-field { margin-top: 10px; }
.triplet-tie-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}
@media (max-width: 370px) {
  .triplet-slot-mode-grid { gap: 5px; }
  .triplet-slot-mode-grid button { font-size: 10px; padding-left: 3px; padding-right: 3px; }
}
