    :root {
      color-scheme: light;
      --ink: #202522;
      --muted: #737b76;
      --paper: #f5f5f2;
      --card: #fff;
      --line: #e5e8e3;
      --green: #176b50;
      --green-soft: #e7f2ec;
      --orange: #ed8a62;
      --pink: #d76bb9;
      --blue: #3fa8c9;
      --purple: #8873cf;
      --shadow: 0 12px 34px rgba(32, 48, 39, .055);
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      background: var(--paper);
      color: var(--ink);
      font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
      line-height: 1.5;
    }
    .shell { max-width: 1160px; margin: 0 auto; padding: 42px 28px 64px; }
    .topline { display: flex; align-items: center; gap: 10px; color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
    .topline-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--green); color: #fff; font-size: 15px; letter-spacing: 0; }
    h1 { margin: 16px 0 7px; font-size: clamp(30px, 5vw, 48px); line-height: 1.1; letter-spacing: -.045em; }
    .intro { margin: 0; color: var(--muted); font-size: 15px; }
    .controls {
      display: flex; flex-wrap: wrap; align-items: end; gap: 18px;
      margin: 28px 0 24px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
    }
    .field { display: grid; gap: 7px; }
    .scale-field { min-width: 245px; }
    .field label, .control-label { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
    select { min-width: 170px; padding: 11px 38px 11px 13px; border: 1px solid #dce1dc; border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 15px; }
    select:focus-visible, button:focus-visible { outline: 3px solid #a9d8c1; outline-offset: 2px; }
    .segmented { display: flex; gap: 4px; padding: 4px; background: #f0f2ef; border-radius: 11px; }
    .segmented button { border: 0; padding: 9px 14px; border-radius: 8px; background: transparent; color: #646d67; font: inherit; font-size: 14px; cursor: pointer; }
    .segmented button[aria-pressed="true"] { background: var(--green); color: #fff; box-shadow: 0 2px 7px rgba(23,107,80,.2); }
    .key-summary { margin-left: auto; align-self: center; text-align: right; }
    .key-summary strong { display: block; font-size: 17px; }
    .key-summary span { color: var(--muted); font-size: 12px; }
    .pentatonic-panel { margin: 0 0 28px; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
    .pentatonic-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; cursor: pointer; font-weight: 700; list-style: none; }
    .pentatonic-panel summary::-webkit-details-marker { display: none; }
    .pentatonic-panel summary::after { content: "+"; color: var(--green); font-size: 22px; line-height: 1; }
    .pentatonic-panel[open] summary::after { content: "−"; }
    .pentatonic-hint { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 400; }
    .pentatonic-content { padding: 0 16px 16px; border-top: 1px solid var(--line); }
    .pentatonic-info { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px 8px; color: var(--muted); font-size: 12px; }
    .pentatonic-scroll { overflow-x: auto; overscroll-behavior-inline: contain; }
    .pentatonic-diagram { display: block; width: 100%; min-width: 930px; height: auto; }
    .pentatonic-legend { display: flex; flex-wrap: wrap; gap: 8px 15px; margin-top: 8px; color: var(--muted); font-size: 11px; }
    .pentatonic-legend-item { display: inline-flex; align-items: center; gap: 6px; }
    .pentatonic-dot { width: 12px; height: 12px; border-radius: 50%; }
    .card-add, .drag-handle, .memo-control { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
    .card-add { display: grid; place-items: center; flex: 0 0 27px; width: 27px; height: 27px; margin-left: auto; border: 1px solid #dfe8e1; border-radius: 8px; color: var(--green); font-size: 19px; line-height: 1; }
    .card-add:hover, .memo-control:hover { background: var(--green-soft); }
    .chord-top .quality { margin-left: 0; }
    .drag-handle { display: grid; place-items: center; flex: 0 0 22px; width: 22px; height: 28px; color: #89938d; font-size: 17px; cursor: grab; touch-action: none; user-select: none; }
    .drag-handle:active { cursor: grabbing; }
    .progression-section { margin-top: 35px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
    .progression-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin-bottom: 15px; }
    .progression-heading h2 { margin: 0; font-size: 20px; }
    .progression-heading p { margin: 0; color: var(--muted); font-size: 12px; }
    .progression-search { position: relative; display: grid; grid-template-columns: minmax(0, 520px) minmax(280px, 320px); grid-template-areas: "picker preview"; align-items: start; column-gap: 24px; margin-bottom: 16px; }
    .chord-picker { grid-area: picker; display: grid; gap: 12px; min-width: 0; }
    .picker-group { display: grid; gap: 6px; }
    .picker-label { color: var(--muted); font-size: 11px; font-weight: 750; }
    .picker-options { display: flex; flex-wrap: wrap; gap: 6px; }
    .picker-option { min-height: 34px; padding: 6px 11px; border: 1px solid #dce1dc; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
    .picker-option:hover { border-color: #a9d8c1; }
    .picker-option[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: #fff; box-shadow: 0 2px 7px rgba(23,107,80,.16); }
    .picker-footer { display: flex; align-items: center; gap: 12px; margin-top: 1px; }
    .picker-message { flex: 1; margin: 0; color: var(--muted); font-size: 11px; }
    .confirm-chord { flex: 0 0 auto; min-height: 38px; padding: 0 16px; border: 1px solid var(--green); border-radius: 9px; background: var(--green); color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
    .confirm-chord:disabled { border-color: #dce1dc; background: #edf0ed; color: #9aa39d; cursor: default; }
    .progression-rows { display: grid; gap: 10px; }
    .progression-row { min-height: 104px; padding: 9px 11px; border: 1.5px dashed #cbd6ce; border-radius: 12px; background: #fbfcfa; transition: background .15s, border-color .15s; }
    .progression-row.drag-over, .progression-row.drop-target { border-color: var(--green); background: var(--green-soft); }
    .progression-list .chord-card.drop-target { border-color: var(--green); box-shadow: 0 0 0 2px #d6ebde; }
    .progression-row-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
    .progression-row-actions { display: flex; align-items: center; gap: 5px; }
    .progression-row-heading { margin: 0; color: var(--muted); font-size: 10px; font-weight: 750; }
    .row-move { min-width: 29px; padding-inline: 7px; }
    .row-move:disabled { opacity: .4; cursor: default; }
    .row-delete { color: #8e5e5e; }
    .row-delete:hover { background: #fbefef; }
    .add-progression-row { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 10px; padding: 10px; border: 1px dashed #b8c8bd; border-radius: 9px; background: #fff; color: var(--green); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
    .add-progression-row:hover { background: var(--green-soft); }
    .drag-ghost { position: fixed; z-index: 1000; pointer-events: none; padding: 8px 13px; border: 1px solid #b8d9c5; border-radius: 9px; background: #fff; box-shadow: 0 8px 22px rgba(32,48,39,.18); font-weight: 700; }
    .progression-list { display: flex; flex-wrap: nowrap; align-items: stretch; gap: 10px; min-height: 72px; overflow-x: auto; overscroll-behavior-inline: contain; }
    .progression-list .chord-card { flex: 0 0 255px; }
    .progression-empty { align-self: center; margin: auto; color: #89938d; font-size: 13px; text-align: center; }
    .memo-control { display: grid; place-items: center; min-width: 27px; height: 25px; padding: 0 6px; border-radius: 6px; color: #657169; font-size: 12px; }
    .memo-card-actions { display: flex; justify-content: flex-end; gap: 5px; padding: 5px 12px 11px; }
    .search-preview { grid-area: preview; width: 100%; max-width: 320px; }
    .search-preview:empty { display: none; }
    .search-preview-label { margin: 8px 0; color: var(--muted); font-size: 11px; font-weight: 700; }
    .section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 30px 2px 14px; }
    .section-head h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
    .section-head p { margin: 0; color: var(--muted); font-size: 12px; }
    .chord-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
    .chord-card { min-width: 0; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 18px rgba(32,48,39,.035); cursor: pointer; transition: box-shadow .15s, transform .15s; }
    .chord-card:hover { box-shadow: 0 8px 22px rgba(32,48,39,.09); }
    .chord-top { display: flex; align-items: center; gap: 11px; padding: 14px 15px 12px; border-bottom: 1px solid #edf0ec; }
    .degree { display: grid; place-items: center; flex: 0 0 31px; height: 31px; border-radius: 10px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 750; }
    .chord-name { font-size: 21px; font-weight: 700; letter-spacing: -.04em; }
    .quality { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
    .diagram-wrap { padding: 7px 8px 0; }
    .diagram { display: block; width: 100%; height: auto; }
    .guitar-diagram { cursor: pointer; touch-action: manipulation; }
    .piano-diagram { cursor: pointer; touch-action: manipulation; }
    .guitar-diagram:focus-visible { outline: 3px solid #a9d8c1; outline-offset: 2px; border-radius: 8px; }
    .guitar-diagram:hover { filter: drop-shadow(0 2px 3px rgba(23,107,80,.16)); }
    .diagram-caption { display: flex; justify-content: space-between; padding: 1px 14px 13px; color: var(--muted); font-size: 11px; }
    .note-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; padding: 0 14px 13px; color: var(--muted); font-size: 11px; }
    .note-values { color: var(--ink); font-weight: 700; letter-spacing: .015em; }
    .legend { display: flex; flex-wrap: wrap; gap: 12px 20px; margin: 15px 2px 0; color: var(--muted); font-size: 11px; }
    .legend-item { display: inline-flex; align-items: center; gap: 7px; }
    .legend-dot { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; color: white; font-size: 9px; font-weight: 700; }
    .notice { margin-top: 26px; padding: 14px 16px; border: 1px solid #dfe8e1; border-radius: 12px; background: #eef5ef; color: #52645a; font-size: 12px; }
    .notice strong { color: #315744; }
    footer { display: flex; justify-content: space-between; gap: 15px; margin-top: 35px; padding-top: 14px; border-top: 1px solid var(--line); color: #8a928c; font-size: 11px; }
    @media (max-width: 900px) { .chord-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
    @media (max-width: 650px) {
      .shell { padding: 26px 15px 42px; }
      .controls { align-items: stretch; gap: 13px; padding: 14px; }
      .field { flex: 1 1 100%; }
      select { width: 100%; }
      .mode-field { flex: 1 1 100%; }
      .segmented button { flex: 1; }
      .key-summary { width: 100%; margin: 1px 0 0; text-align: left; }
      .pentatonic-panel summary { padding: 14px; }
      .pentatonic-hint { display: none; }
      .pentatonic-content { padding-inline: 10px; }
      .pentatonic-info { flex-direction: column; gap: 3px; }
      .progression-section { padding: 15px; }
      .progression-heading { align-items: start; flex-direction: column; gap: 4px; }
      .progression-search { grid-template-columns: minmax(0, 1fr); grid-template-areas: "picker" "preview"; row-gap: 16px; }
      .progression-row { padding: 8px; }
      .section-head { align-items: start; flex-direction: column; }
      .chord-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
      .chord-top { gap: 7px; padding: 11px 10px 9px; }
      .degree { flex-basis: 27px; height: 27px; }
      .chord-name { font-size: 19px; }
      .quality { display: none; }
      .card-add { flex-basis: 24px; width: 24px; height: 24px; }
      .chord-top .drag-handle { flex-basis: 18px; width: 18px; }
      .diagram-wrap { padding-inline: 4px; }
      .diagram-caption { padding-inline: 10px; }
      footer { flex-direction: column; }
    }
