/* =========================================
   音楽ツール共通レイアウト（doc/デザイン.html 準拠）
   metronome / tuner / bpm-delay-calculator / audio-fade / audio-merge / audio-waveform-video で共用。
   base.css → benri-kit.css → ui-kit.css の後に読み込む。
   操作パーツ（切替タブ・チェック・トグル・スライダー・FAQ・通知・ロード中・アップロード）は ui-kit.css を使う。
   ========================================= */
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
[hidden] { display: none !important; }
main button, main input, main select, main textarea { font-family: inherit; }

/* ---------- ヒーロー：左に見出し、右に小さな画像。スマホでは画像を出さずツールを上げる ---------- */
.mt-hero { padding: 32px 0 18px; }
.mt-hero-inner { display: flex; align-items: center; gap: 40px; }
.mt-hero-copy { flex: 1 1 0; min-width: 0; }
.mt-hero h1 { font-size: clamp(30px, 4.4vw, 44px); font-weight: 800; line-height: 1.4; letter-spacing: .02em; }
.mt-hero .phrase, .mt-copy .phrase { display: inline-block; }
.mt-tagline { margin: 14px 0 6px; font-size: 19px; font-weight: 700; line-height: 1.6; }
.mt-copy { color: var(--text-sub); font-size: 15px; line-height: 1.9; }
.mt-hero-card { flex: 0 0 auto; width: clamp(180px, 23vw, 260px); margin: 0; overflow: hidden; border: 1px solid #e1edf4; border-radius: 20px; background: #f1f8fd; box-shadow: 0 10px 28px rgba(15, 65, 90, .07); }
.mt-hero-card img { display: block; width: 100%; height: auto; }

/* ---------- ツール枠 ---------- */
.mt-tool { padding: 4px 0 52px; }
.mt-tool > .container { max-width: 1120px; }
.mt-card { min-width: 0; padding: 24px; border: 1px solid #f0f3f6; border-radius: 16px; background: #fff; box-shadow: var(--kit-shadow-card); }
.mt-card + .mt-card { margin-top: 18px; }
.mt-title { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: 17px; font-weight: 800; }
.mt-title i { color: var(--primary-color); }
.mt-title small { margin-left: auto; color: var(--text-sub); font-size: 12px; font-weight: 700; }
.mt-sub { margin: 22px 0 10px; font-size: 14px; font-weight: 800; }
.mt-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px 24px; }
.mt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.mt-row + .mt-row { margin-top: 14px; }

/* 入力欄 */
.field-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.field-help { margin-top: 8px; color: var(--text-sub); font-size: 12px; line-height: 1.7; }
.field-warn { margin-top: 8px; color: var(--kit-warning); font-size: 12px; font-weight: 700; line-height: 1.7; }
.field-warn:empty { display: none; }
.unit-field { position: relative; }
.unit-field .form-input { padding-right: 58px; }
.unit-field > span { position: absolute; top: 50%; right: 16px; transform: translateY(-50%); color: var(--text-sub); font-size: 14px; font-weight: 700; pointer-events: none; }
.mt-num { width: 100%; font-variant-numeric: tabular-nums; }
.range-line { display: flex; align-items: center; gap: 14px; }
.range-line input[type=range] { flex: 1; min-width: 0; }
.range-line output { min-width: 64px; color: var(--primary-color); font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* チップ（切替の数が多いときの折り返す切替） */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 8px 15px; border: 2px solid #e5eaee; border-radius: 9999px; background: #fff; color: var(--text-main); font-size: 14px; font-weight: 700; line-height: 1.3; cursor: pointer; transition: transform .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease; }
.chip small { color: var(--text-sub); font-size: 11px; font-weight: 700; }
@media (hover: hover) { .chip:hover { transform: scale(1.03); border-color: var(--primary-color); } }
.chip:active { transform: scale(.95); }
.chip[aria-pressed=true] { border-color: var(--primary-color); background: var(--primary-color); color: #fff; box-shadow: 0 4px 10px rgba(0, 174, 239, .25); animation: preset-bounce .3s cubic-bezier(.4, 0, .2, 1); }
.chip[aria-pressed=true] small { color: rgba(255, 255, 255, .85); }
.chip:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* 小さな丸ボタン（±1 など） */
.step-btn { min-width: 48px; height: 44px; padding: 0 12px; border: 2px solid #e5eaee; border-radius: 12px; background: #fff; color: var(--text-main); font-size: 15px; font-weight: 800; cursor: pointer; transition: transform .2s ease, border-color .2s ease, color .2s ease; font-variant-numeric: tabular-nums; }
@media (hover: hover) { .step-btn:hover { border-color: var(--primary-color); color: var(--primary-color); } }
.step-btn:active { transform: scale(.94); }

.text-button { padding: 4px 2px; border: 0; background: none; color: var(--primary-color); font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.text-button:disabled { color: #aaa; cursor: not-allowed; }
.btn i { margin-right: 8px; }
.btn.btn-lg { min-height: 56px; padding: 14px 40px; font-size: 17px; }
.btn.is-busy { pointer-events: none; opacity: .75; }

/* 詳細設定（薄い青の補助パネル） */
.mt-details { margin-top: 20px; border-radius: 12px; background: var(--bg-light); }
.mt-details > summary { display: flex; align-items: center; gap: 10px; padding: 15px 18px; font-size: 14px; font-weight: 800; list-style: none; cursor: pointer; }
.mt-details > summary::-webkit-details-marker { display: none; }
.mt-details > summary i { color: var(--primary-color); }
.mt-details > summary::after { content: ""; width: 12px; height: 12px; margin-left: auto; background: linear-gradient(#666, #666) center / 12px 2px no-repeat, linear-gradient(#666, #666) center / 2px 12px no-repeat; transition: transform .25s ease; }
.mt-details[open] > summary::after { background: linear-gradient(#666, #666) center / 12px 2px no-repeat; transform: rotate(180deg); }
.mt-details-body { padding: 2px 18px 20px; }
.mt-details[open] .mt-details-body { animation: bk-fade-down .25s ease; }

/* 通知・状態 */
.mt-tool .alert { margin-top: 16px; }
.mt-tool .alert > div { min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
.mt-status { display: flex; align-items: center; gap: 8px; color: var(--text-sub); font-size: 13px; line-height: 1.7; }
.mt-status i { color: var(--primary-color); }
.mt-note { color: var(--text-sub); font-size: 12px; line-height: 1.8; }

/* アップロード（ui-kit の .upload-area-rich に高さだけ足す） */
.upload-area-rich .upload-title { margin-top: 6px; font-size: 18px; font-weight: 800; }
.upload-area-rich .upload-formats { overflow-wrap: anywhere; }

/* ロード中（doc/デザイン.html の Loading） */
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 240px; padding: 28px 20px; border: 1px solid var(--kit-line); border-radius: 16px; background: #fff; box-shadow: var(--kit-shadow-card); text-align: center; }
.loading-screen strong { font-size: 17px; }
.loading-screen p { margin-top: 8px; color: var(--text-sub); font-size: 13px; line-height: 1.8; }
.mt-progress { width: min(360px, 100%); height: 8px; margin: 16px auto 0; overflow: hidden; border-radius: 999px; background: #e9eef2; }
.mt-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary-color), #5fd0ff); transition: width .25s ease; }

/* 結果 */
.mt-done { margin-top: 18px; border: 2px solid var(--kit-safe-line); }
.mt-done-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.mt-done-head h2 { font-size: 17px; font-weight: 800; }
.mt-done .mt-done-text { margin-top: 8px; color: var(--text-sub); font-size: 14px; line-height: 1.8; }
.mt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.mt-stale { margin-top: 12px; }

/* 一覧 */
.mt-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--kit-line); border-radius: 12px; overflow: hidden; }
.mt-list > li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--kit-line); background: #fff; }
.mt-list > li:last-child { border-bottom: 0; }
.mt-list .li-main { flex: 1 1 auto; min-width: 0; }
.mt-list .li-main strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.mt-list .li-main small { display: block; color: var(--text-sub); font-size: 12px; line-height: 1.6; }
.icon-btn { display: inline-grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid #e5eaee; border-radius: 10px; background: #fff; color: var(--text-sub); font-size: 14px; cursor: pointer; transition: transform .2s ease, color .2s ease, border-color .2s ease; }
@media (hover: hover) { .icon-btn:hover:not(:disabled) { border-color: var(--primary-color); color: var(--primary-color); } }
.icon-btn:active:not(:disabled) { transform: scale(.92); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.is-danger:hover { border-color: var(--kit-danger); color: var(--kit-danger); }

/* 関連ツール */
.mt-related { padding: 6px 0 46px; }
.mt-related .container { max-width: 1000px; }
.mt-related h2 { margin-bottom: 6px; font-size: 22px; font-weight: 800; }
.mt-related .container > p { margin-bottom: 18px; color: var(--text-sub); font-size: 14px; }

/* 解説の表を数字で読みやすく */
.bk-guide .bk-table td, .bk-guide .bk-table th { font-variant-numeric: tabular-nums; }

/* トースト（コピーした値など） */
.mt-toast { position: fixed; left: 50%; bottom: 24px; z-index: 1200; max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 9999px; background: rgba(34, 40, 49, .92); color: #fff; font-size: 14px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.mt-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.mt-toast i { margin-right: 8px; color: #7fe3a8; }

@media (max-width: 960px) {
    .mt-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .mt-hero { padding: 22px 0 12px; }
    .mt-hero h1 { font-size: clamp(25px, 7vw, 34px); }
    .mt-hero-card { display: none; }
    .mt-tagline { margin-top: 10px; font-size: 16px; }
    .mt-copy { font-size: 13px; }
    .mt-card { padding: 18px 16px; }
    .mt-related h2 { font-size: 20px; }
    .btn.btn-lg { width: 100%; padding: 14px 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .chip, .step-btn, .icon-btn, .mt-toast, .mt-progress span { animation: none !important; transition: none !important; }
    .chip:hover, .chip:active, .step-btn:active, .icon-btn:active { transform: none; }
}
