/* トランジションメーカー — ページ固有のスタイル。配色は /assets/css/base.css の変数を使う。
   クラス名の接頭辞は mtr-（テロップメーカーの tam- にあたる）。 */

/* Web フォントが届くまでの代役：端末に入っている極太ゴシックを「太さ 400」として使えるようにする */
@font-face {
    font-family: 'MTR Heavy';
    font-weight: 400;
    src: local('HiraginoSans-W8'), local('Hiragino Sans W8'), local('HiraKakuStdN-W8'), local('NotoSansJP-Black'),
        local('Noto Sans JP Black'), local('Noto Sans CJK JP Black'), local('YuGothic-Bold'), local('Yu Gothic Bold'), local('Meiryo-Bold');
}

.mtr {
    --mtr-ink: #14161d;
    --mtr-line: #e3eaef;
    --mtr-soft: #f4f9fc;
    --mtr-in: #00aeef;      /* 入り（前） */
    --mtr-hold: #ffc93d;    /* 覆っている時間（中） */
    --mtr-out: #ff6b6b;     /* 抜け（後） */
    --mtr-stage-h: 380px;
    padding-bottom: 56px;
}
.mtr [hidden] { display: none !important; }
.mtr-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
}
.mtr button, .mtr select, .mtr textarea, .mtr input { font-family: inherit; }
.mtr :focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}
.nb { display: inline-block; }

/* ---------- 見出し ---------- */
.mtr-intro { padding-top: 26px; padding-bottom: 14px; }
.mtr-intro h1 {
    font-size: clamp(23px, 4.4vw, 38px);
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: .02em;
}
.mtr-intro p {
    margin-top: 10px;
    max-width: 50em;
    color: var(--text-sub);
    font-size: 15px;
    line-height: 1.9;
}
.mtr-intro .mtr-mark { background: linear-gradient(transparent 70%, var(--accent-yellow) 70%); }

/* ---------- 全体の並び（スマホ：プレビュー → マイトランジション → 1 → 2 → 文字ロゴ → 保存 → 詳細） ---------- */
.mtr-app, .mtr-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}
.mtr-card {
    background: #fff;
    border: 1px solid var(--mtr-line);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .05);
    padding: 18px 16px;
}
.mtr-card h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.4;
}
.mtr-card h2 small {
    color: var(--text-sub);
    font-size: 12px;
    font-weight: 500;
}
.mtr-card h2 > i { color: var(--primary-color); font-size: 16px; }
.mtr .step {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-yellow);
    font-size: 15px;
    font-weight: 800;
}
.mtr-note {
    margin-top: 8px;
    color: var(--text-sub);
    font-size: 12px;
    line-height: 1.7;
}
.mtr-note:empty { display: none; }
.mtr code {
    padding: 1px 5px;
    border-radius: 5px;
    background: #eef3f6;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .92em;
}
.mtr-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    border: 0;
    background: none;
    color: #007ea9;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}
.mtr-chip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--mtr-line);
    border-radius: 999px;
    background: #fff;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s, border-color .15s, background .15s;
}
.mtr-chip-btn:active { transform: scale(.95); }
.mtr-chip-btn i { color: var(--primary-color); }

/* ---------- プレビュー（スクロールしても上に残る） ---------- */
.mtr-stage {
    position: sticky;
    top: 62px;
    z-index: 30;
    margin: 0 -8px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 12px 26px rgba(30, 41, 59, .12);
}
.mtr-screen-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 12px;
    background: var(--mtr-ink);
}
.mtr-screen {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #23252e;
    cursor: pointer;
}
.mtr-screen[data-bg="alpha"] {
    background: repeating-conic-gradient(#3b3f4b 0 25%, #2a2d37 0 50%) 0 0 / 22px 22px;
}
.mtr-screen canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.mtr-screen-msg {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    background: var(--mtr-ink);
    color: #fff;
    font-size: 14px;
    line-height: 1.8;
    text-align: center;
}
.mtr-screen-note, .mtr-time-label {
    position: absolute;
    left: 8px;
    z-index: 2;
    max-width: calc(100% - 62px);
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(20, 22, 29, .72);
    color: #fff;
    font-size: 11px;
    line-height: 1.5;
    pointer-events: none;
}
.mtr-screen-note { top: 8px; }
.mtr-time-label { bottom: 8px; font-variant-numeric: tabular-nums; }
/* 効果音のオン・オフ（プレビューの右上） */
.mtr-sound {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(20, 22, 29, .72);
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: transform .15s, background .15s;
}
.mtr-sound::before { content: ''; position: absolute; inset: -3px; }
.mtr-sound:active { transform: scale(.92); }
.mtr-sound[aria-pressed="false"] { background: rgba(20, 22, 29, .5); color: rgba(255, 255, 255, .75); }
.mtr-export {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(20, 22, 29, .9);
    color: #fff;
    text-align: center;
}
.mtr-export strong { font-size: 14px; }
.mtr-export progress {
    width: min(78%, 360px);
    height: 10px;
    accent-color: var(--primary-color);
}
.mtr-cancel {
    min-height: 44px;
    padding: 0 16px;
    border: 1.5px solid rgba(255, 255, 255, .6);
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.loading-bars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
}
.loading-bars span {
    width: 4px;
    height: 34px;
    border-radius: 999px;
    background: var(--primary-color);
    animation: mtr-wave .9s ease-in-out infinite;
}
.loading-bars span:nth-child(2) { background: var(--accent-pink); animation-delay: -.8s; }
.loading-bars span:nth-child(3) { background: var(--accent-yellow); animation-delay: -.7s; }
.loading-bars span:nth-child(4) { background: var(--accent-pink); animation-delay: -.6s; }
.loading-bars span:nth-child(5) { animation-delay: -.5s; }
@keyframes mtr-wave {
    0%, 40%, 100% { transform: scaleY(.08); }
    20% { transform: scaleY(1); }
}

/* ---------- 時間バー（入り・覆っている時間・抜け。境目のつまみで長さを変える） ---------- */
.mtr-track {
    position: relative;
    height: 40px;
    margin: 4px 11px 0;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.mtr-track::before {            /* 目盛りの下地（いちばん右が「いま表示している最大の秒数」） */
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 17px;
    height: 12px;
    border-radius: 999px;
    background: #e6edf1;
}
.mtr-bar {
    position: absolute;
    left: 0;
    top: 17px;
    display: flex;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
}
.mtr-bar span { display: block; height: 100%; }
.mtr-bar .in { background: var(--mtr-in); }
.mtr-bar .hold { background: var(--mtr-hold); }
.mtr-bar .out { background: var(--mtr-out); }
.mtr-cut {                       /* 切り替えポイントの印（▼） */
    position: absolute;
    top: 3px;
    width: 0;
    height: 0;
    margin-left: -7px;
    border: 7px solid transparent;
    border-top: 10px solid var(--mtr-ink);
    border-bottom: 0;
    pointer-events: none;
}
.mtr-head {                      /* いま再生している位置 */
    position: absolute;
    top: 12px;
    width: 3px;
    height: 22px;
    margin-left: -1.5px;
    border-radius: 2px;
    background: var(--mtr-ink);
    box-shadow: 0 0 0 1.5px #fff;
    pointer-events: none;
}
.mtr-knob {
    position: absolute;
    top: 13px;
    width: 20px;
    height: 20px;
    margin-left: -10px;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--mtr-ink);
    box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
    cursor: ew-resize;
    touch-action: none;
}
.mtr-knob::before { content: ''; position: absolute; inset: -14px -9px; }      /* 押しやすい広さ */
.mtr-knob[data-on="true"] { background: var(--primary-color); transform: scale(1.18); }
.mtr-track[data-scrub="true"] .mtr-head { background: var(--primary-color); }

.mtr-transport {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.mtr-round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1.5px solid var(--mtr-line);
    border-radius: 999px;
    background: #fff;
    color: #445;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, background .15s, border-color .15s, color .15s;
}
.mtr-round:active { transform: scale(.93); }
.mtr-round span { display: none; }
.mtr-round[aria-pressed="true"] { border-color: var(--primary-color); background: var(--primary-color); color: #fff; }
.mtr-round.mtr-replay { border-color: var(--mtr-ink); background: var(--mtr-ink); color: #fff; }

/* ---------- 切り替えボタン（サイズ・背景・形式など） ---------- */
.mtr-seg {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.mtr-seg button, .mtr-seg .mtr-color-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 12px;
    border: 1.5px solid var(--mtr-line);
    border-radius: 999px;
    background: #fff;
    color: #445;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: transform .15s, background .15s, border-color .15s, color .15s;
}
.mtr-seg button small {
    color: #8a96a3;
    font-size: 11px;
    font-weight: 500;
}
.mtr-seg button:active { transform: scale(.95); }
.mtr-seg button[aria-pressed="true"], .mtr-seg .mtr-color-chip[data-on="true"] {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}
.mtr-seg button[aria-pressed="true"] small { color: rgba(255, 255, 255, .85); }
.mtr-seg button:disabled { opacity: .4; cursor: not-allowed; }
.mtr-seg.sm button { min-width: 56px; }
.mtr-bg-more { flex-basis: 100%; }
.mtr-sizes { flex: 1 1 auto; flex-wrap: nowrap; min-width: 0; }
.mtr-sizes button {
    flex: 1 1 0;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    padding: 0 2px;
    font-size: 12px;
    white-space: nowrap;
}
.mtr-sizes button small { font-size: 10px; }
.mtr-dot {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border: 1px solid rgba(0, 0, 0, .18);
    border-radius: 50%;
}
.mtr-dot.alpha { background: repeating-conic-gradient(#b9c0c9 0 25%, #fff 0 50%) 0 0 / 8px 8px; }
.mtr-dot.in { border: 0; background: var(--mtr-in); }
.mtr-dot.hold { border: 0; background: var(--mtr-hold); }
.mtr-dot.out { border: 0; background: var(--mtr-out); }
.mtr-color-chip { position: relative; overflow: hidden; }
.mtr-color-chip input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ---------- マイトランジション ---------- */
.mtr-shelf {
    display: flex;
    gap: 10px;
    margin: 0 -16px;
    padding: 2px 16px 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
}
.mtr-item {
    flex: 0 0 228px;
    scroll-snap-align: start;
    border: 1.5px solid var(--mtr-line);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.mtr-item[data-open="true"] { border-color: var(--primary-color); background: var(--mtr-soft); }
.mtr-item-open {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: #1b1e27;
    cursor: pointer;
}
.mtr-item-open canvas { display: block; width: 100%; aspect-ratio: 16 / 9; }
.mtr-item-name { padding: 8px 10px 2px; }
.mtr-item-name strong {
    display: block;
    overflow: hidden;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mtr-item-name small { display: block; color: var(--text-sub); font-size: 11px; }
.mtr-item-name input {
    width: 100%;
    min-height: 32px;
    padding: 0 8px;
    border: 1.5px solid var(--primary-color);
    border-radius: 8px;
    font-size: 16px;
}
.mtr-item-tools { display: flex; }
.mtr-item-tools button {
    flex: 1 1 0;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: #5a6673;
    font-size: 14px;
    cursor: pointer;
}
.mtr-item-tools button[aria-pressed="true"] { color: #e0a100; }
.mtr-item-tools button[data-sure="true"] { color: #fff; background: #e5484d; font-size: 12px; font-weight: 800; }

/* ---------- 1. 動きを選ぶ ---------- */
.mtr-editing {
    margin: -4px 0 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--mtr-soft);
    color: #0b6b8f;
    font-size: 12.5px;
    line-height: 1.6;
}
.mtr-chips {
    display: flex;
    gap: 6px;
    margin: 0 -16px 10px;
    padding: 2px 16px;
    overflow-x: auto;
    scrollbar-width: none;
}
.mtr-chips::-webkit-scrollbar { display: none; }
.mtr-chips button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--mtr-line);
    border-radius: 999px;
    background: #fff;
    color: #445;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}
.mtr-chips button[aria-pressed="true"] { border-color: var(--mtr-ink); background: var(--mtr-ink); color: #fff; }
.mtr-find {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.mtr-search {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    padding: 0 12px;
    border: 1.5px solid var(--mtr-line);
    border-radius: 10px;
    background: #fff;
    color: var(--text-main);
    font-size: 16px;
}
.mtr-search:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px var(--input-focus-ring);
}
.mtr-find .mtr-chip-btn { flex: 0 0 auto; }
.mtr-color-mode {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 10px;
    margin-bottom: 8px;
    color: var(--text-sub);
    font-size: 12px;
}
.mtr-group + .mtr-group { margin-top: 16px; }
.mtr-group h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 800;
}
.mtr-group h3 small {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--mtr-soft);
    color: var(--text-sub);
    font-size: 11px;
    font-weight: 700;
}
.mtr-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.mtr-preset {
    position: relative;
    display: block;
    width: 100%;
    padding: 4px 4px 8px;
    border: 2px solid transparent;
    border-radius: 12px;
    background: var(--mtr-soft);
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, transform .15s;
}
.mtr-preset:active { transform: scale(.97); }
.mtr-preset canvas {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    background: #1b1e27;
}
.mtr-preset strong {
    display: block;
    margin: 7px 4px 0;
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.3;
}
.mtr-preset small {
    display: -webkit-box;
    margin: 2px 4px 0;
    overflow: hidden;
    color: var(--text-sub);
    font-size: 11px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.mtr-preset[aria-pressed="true"] { border-color: var(--primary-color); background: #fff; box-shadow: 0 6px 16px rgba(0, 174, 239, .18); }
.mtr-preset[aria-pressed="true"] strong { color: #0081b2; }
.mtr-preset[aria-pressed="true"] strong::before { content: '✓ '; }
.mtr-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    pointer-events: none;
}
.mtr-badges i {
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(20, 22, 29, .78);
    color: #fff;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    line-height: 1.5;
}
.mtr-badges .new { background: #e5484d; }
.mtr-badges .tex { background: rgba(122, 86, 38, .9); }               /* テクスチャ画像を使う動き */
.mtr-badges .text { display: none; background: rgba(0, 129, 178, .92); }
.mtr-groups[data-text="true"] .mtr-badges .text { display: block; }   /* 文字・ロゴを入れているときだけ「文字OK」を出す */
.mtr-empty {
    margin: 4px 0 12px;
    color: var(--text-sub);
    font-size: 13px;
}

/* ---------- 2. 色・向き・速さ ---------- */
.mtr-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}
.mtr-field:last-child { margin-bottom: 0; }
.mtr-field-label {
    flex: 0 0 auto;
    min-width: 2.6em;
    padding-top: 12px;
    color: var(--text-sub);
    font-size: 13px;
    font-weight: 700;
}
.mtr-field-body { flex: 1 1 auto; min-width: 0; }
.mtr-swatches {
    display: flex;
    gap: 6px;
    margin: 0 -16px 0 0;
    padding: 3px 16px 3px 3px;
    overflow-x: auto;
    scrollbar-width: none;
}
.mtr-swatches::-webkit-scrollbar { display: none; }
.mtr-swatches button {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 44px;
    height: 44px;
    padding: 0 8px;
    border: 1.5px solid var(--mtr-line);
    border-radius: 999px;
    background: #fff;
    color: #445;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}
.mtr-swatches button:active { transform: scale(.93); }
.mtr-swatches button[aria-pressed="true"] { border-color: var(--text-main); box-shadow: 0 0 0 2px var(--text-main); }
.mtr-swatches button i {              /* 3 色の丸 */
    display: block;
    width: 18px;
    height: 18px;
    margin-left: -6px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .14);
}
.mtr-swatches button i:first-child { z-index: 2; width: 24px; height: 24px; margin-left: 0; }
.mtr-swatches button i:nth-child(2) { z-index: 1; }
.mtr-swatches .rainbow i {
    width: 24px;
    height: 24px;
    background: conic-gradient(#ff3b30, #ff9500, #ffcc00, #ff2bd6, #af52de, #007aff, #ff3b30);
}
.mtr-swatches .rainbow span, .mtr-swatches .mine span { margin-left: 5px; }
.mtr-custom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--mtr-soft);
}
.mtr-pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
}
.mtr-pick input[type="color"], .mtr-text-color input[type="color"] {
    width: 44px;
    height: 44px;
    padding: 2px;
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}
.mtr-pick input:disabled { opacity: .45; cursor: not-allowed; }
.mtr-keep-color {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;           /* 入力欄の幅に引っぱられて、カードからはみ出さないように */
}
.mtr-keep-color input {
    flex: 1 1 110px;
    width: 0;
    min-width: 0;
    min-height: 44px;
    padding: 0 10px;
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    background: #fff;
    font-size: 16px;
}
.mtr-my-colors {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
}
.mtr-my-colors button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--mtr-line);
    border-radius: 999px;
    background: #fff;
    color: #5a6673;
    font-size: 12px;
    cursor: pointer;
}
.mtr-dirs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}
.mtr-pad {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    gap: 4px;
}
.mtr-pad.two { grid-template-columns: repeat(2, 44px); }
.mtr-pad button, .mtr-origin button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1.5px solid var(--mtr-line);
    border-radius: 10px;
    background: #fff;
    color: #445;
    font-size: 14px;
    cursor: pointer;
}
.mtr-pad button[aria-pressed="true"], .mtr-origin button[aria-pressed="true"] {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}
.mtr-pad .blank { visibility: hidden; }
.mtr-origin { display: grid; grid-template-columns: repeat(3, 44px); gap: 4px; }
.mtr-origin button::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    opacity: .45;
}
.mtr-origin button[aria-pressed="true"]::after { opacity: 1; }
.mtr-speeds button { flex: 1 1 0; flex-direction: column; gap: 1px; min-width: 0; padding: 0 6px; }
.mtr-speeds button[data-v="custom"] { flex: 0 0 auto; padding: 0 12px; }

/* ---------- 3. 保存 ---------- */
.mtr-shortcuts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.mtr-shortcuts button {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 56px;
    padding: 6px 10px;
    border: 1.5px solid var(--mtr-line);
    border-radius: 12px;
    background: #fff;
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.mtr-shortcuts button > i {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--mtr-soft);
    color: #0081b2;
    font-size: 14px;
}
.mtr-shortcuts strong { display: block; font-size: 12.5px; font-weight: 800; line-height: 1.3; }
.mtr-shortcuts small { display: block; color: var(--text-sub); font-size: 10.5px; line-height: 1.35; }
.mtr-shortcuts button[aria-pressed="true"] { border-color: var(--primary-color); background: var(--mtr-soft); }
.mtr-shortcuts button[aria-pressed="true"] > i { background: var(--primary-color); color: #fff; }
.mtr-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.mtr-check input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}
.mtr-check small { display: block; color: var(--text-sub); font-size: 11px; font-weight: 500; }
.mtr-check.sm { font-size: 12px; }
.mtr-hint {
    margin: 2px 0 12px;
    color: var(--text-sub);
    font-size: 12.5px;
    line-height: 1.75;
}
.mtr-hint.warn {
    padding: 9px 12px;
    border: 1px solid #fbd38d;
    border-radius: 10px;
    background: #fffaf0;
    color: #975a16;
}
.mtr-hint.warn button {
    margin-left: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: #007ea9;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}
.mtr-save-row { display: grid; }
.mtr-keep-row { text-align: center; }
.mtr .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    font-size: 14px;
}
.mtr .btn:hover { transform: translateY(-1px); }
.mtr .btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.mtr .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.mtr .mtr-save {
    width: 100%;
    min-height: 58px;
    font-size: 17px;
    box-shadow: 0 10px 22px rgba(0, 174, 239, .3);
}
.mtr-keep { gap: 6px; font-size: 12.5px; }
.mtr-keep:disabled { opacity: .5; }
.mtr-status {
    margin-top: 10px;
    color: #0b6b8f;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.6;
}
.mtr-status:empty { display: none; }
.mtr-toast {
    position: fixed;
    z-index: 2000;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(520px, calc(100% - 32px));
    padding: 14px 18px;
    border: 1px solid #feb2b2;
    border-radius: 12px;
    background: #fff5f5;
    color: #9b2c2c;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .16);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
}
.mtr-toast[hidden] { display: none; }
.mtr-alert {
    margin-top: 12px;
    padding: 11px 14px;
    border: 1px solid #feb2b2;
    border-radius: 10px;
    background: #fff5f5;
    color: #c53030;
    font-size: 13px;
    line-height: 1.7;
}
.mtr-result {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid #b2f5ea;
    border-radius: 12px;
    background: #e6fffa;
    color: #2c7a7b;
}
.mtr-result-title {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.5;
}
.mtr-result-title i { margin-top: 3px; }
.mtr-result-facts { margin: 10px 0 0; font-size: 13px; line-height: 1.6; }
.mtr-result-facts div + div { margin-top: 6px; }
.mtr-result-facts dt { color: #285e61; font-size: 11.5px; font-weight: 700; }
.mtr-result-facts dd {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin: 0;
    color: #1d4044;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.mtr-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.mtr-result-meta {
    margin-top: 8px;
    font-size: 12px;
    overflow-wrap: anywhere;
}
.mtr-result-tip {
    margin-top: 6px;
    color: #285e61;
    font-size: 12.5px;
    line-height: 1.75;
}
/* 次にやること */
.mtr-next {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--mtr-line);
}
.mtr-next h3 { margin-bottom: 8px; font-size: 14px; font-weight: 800; }
.mtr-next-item {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--mtr-soft);
}
.mtr-next-item + .mtr-next-item { margin-top: 8px; }
.mtr-next-item > strong { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 800; }
.mtr-next-item p { margin-bottom: 8px; color: var(--text-sub); font-size: 12.5px; line-height: 1.7; }
.mtr-next-buttons, .mtr-next-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mtr-next-row { background: none; padding: 0; }
.mtr-next-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}
.mtr-next-cards .mtr-preset { background: #fff; }

/* ---------- 文字・ロゴ／詳細設定 ---------- */
.mtr-details { padding: 0; }
.mtr-details summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 10px;
    min-height: 44px;
    padding: 14px 44px 14px 16px;
    position: relative;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}
.mtr-details summary::-webkit-details-marker { display: none; }
.mtr-details summary span {
    color: var(--text-sub);
    font-size: 12px;
    font-weight: 500;
}
.mtr-details summary::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    width: 9px;
    height: 9px;
    margin-top: -7px;
    border-right: 2.5px solid #8a96a3;
    border-bottom: 2.5px solid #8a96a3;
    transform: rotate(-45deg);
    transition: transform .2s;
}
.mtr-details[open] summary::after { transform: rotate(45deg); }
.mtr-details-body { padding: 0 16px 18px; }
.mtr-details fieldset {
    margin: 0 0 14px;
    padding: 12px 14px 14px;
    border: 0;
    border-radius: 12px;
    background: var(--mtr-soft);
}
.mtr-details legend {
    float: left;
    width: 100%;
    margin-bottom: 8px;
    padding: 0;
    font-size: 13px;
    font-weight: 800;
}
.mtr-details legend + * { clear: both; }
.mtr-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 700; }
.mtr-textarea {
    display: block;
    width: 100%;
    min-height: 68px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    background: #fcfcfc;
    color: var(--text-main);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;
    resize: vertical;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.mtr-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--input-focus-ring);
    background: #fff;
}
.mtr-row {
    display: grid;
    grid-template-columns: 7.6em minmax(0, 1fr) 4.2em;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    font-size: 13px;
}
.mtr-row > label, .mtr-row-label { font-weight: 700; }
.mtr-row output, .mtr-time-row output {
    color: var(--text-sub);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.mtr-row select {
    grid-column: 2 / -1;
    min-height: 44px;
    padding: 0 10px;
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    background: #fff;
    font-size: 16px;
}
.mtr-row .mtr-seg, .mtr-row .mtr-logo, .mtr-row .mtr-origin, .mtr-row .mtr-text-color { grid-column: 2 / -1; }
.mtr-row input[type="range"], .mtr-time-row input[type="range"] {
    width: 100%;
    min-width: 0;
    height: 28px;
    accent-color: var(--primary-color);
}
.mtr-logo, .mtr-text-color {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}
.mtr-file { position: relative; overflow: hidden; max-width: 100%; }
.mtr-file span { overflow: hidden; max-width: 11em; text-overflow: ellipsis; white-space: nowrap; }
.mtr-file input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
/* 時間の配分：名前／− スライダー ＋／秒・コマ */
.mtr-time-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px 8px;
    padding: 4px 0 8px;
    font-size: 13px;
}
.mtr-time-row + .mtr-time-row { border-top: 1px solid #e2ecf2; }
.mtr-time-row label { display: flex; align-items: center; gap: 7px; font-weight: 700; }
.mtr-time-row output { color: var(--text-main); font-size: 13px; font-weight: 800; white-space: nowrap; }
.mtr-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
    grid-column: 1 / -1;
}
.mtr-stepper button {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1.5px solid var(--mtr-line);
    border-radius: 50%;
    background: #fff;
    color: #445;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}
.mtr-stepper button:disabled { opacity: .35; cursor: not-allowed; }
.mtr-total {
    margin-top: 6px;
    padding: 9px 12px;
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.7;
    font-variant-numeric: tabular-nums;
}

/* ---------- 説明コンテンツ ---------- */
.mtr-doc {
    max-width: 860px;
    margin-top: 46px;
}
.mtr-doc section { margin-bottom: 38px; }
.mtr-doc h2 {
    margin-bottom: 14px;
    font-size: clamp(19px, 3vw, 23px);
    font-weight: 800;
    line-height: 1.5;
}
.mtr-doc h3 {
    margin: 22px 0 10px;
    font-size: 16px;
    font-weight: 800;
}
.mtr-doc p {
    color: #444;
    font-size: 15px;
    line-height: 2;
}
.mtr-doc p + p { margin-top: 10px; }
.mtr-doc .mtr-small { color: var(--text-sub); font-size: 13px; }
.mtr-related { margin-bottom: 38px; }
.mtr-related .image-movie-links {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}
.mtr-steps {
    display: grid;
    gap: 12px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: mtr-step;
}
.mtr-steps li {
    display: flex;
    gap: 14px;
    padding: 16px;
    border-radius: 14px;
    background: var(--mtr-soft);
    counter-increment: mtr-step;
}
.mtr-steps li::before {
    content: counter(mtr-step);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-yellow);
    font-weight: 800;
}
.mtr-steps strong { font-size: 15px; }
.mtr-steps p { margin-top: 2px; font-size: 13.5px; line-height: 1.8; }
.mtr-bullets, .mtr-numbers {
    margin: 12px 0;
    padding-left: 1.3em;
    list-style: disc;
    color: #444;
    font-size: 14.5px;
    line-height: 2;
}
.mtr-numbers { padding-left: 1.6em; list-style: decimal; }
/* カット位置に合わせる図 */
.mtr-figure {
    margin: 16px 0;
    padding: 16px 14px 12px;
    border-radius: 14px;
    background: var(--mtr-ink);
    color: #fff;
    font-size: 12px;
}
.mtr-figure-row { display: flex; align-items: center; gap: 10px; }
.mtr-figure-row + .mtr-figure-row { margin-top: 6px; }
.mtr-figure-name { flex: 0 0 6.4em; color: #a9b4c4; font-size: 11px; }
.mtr-figure-lane { display: flex; flex: 1 1 auto; min-width: 0; }
.mtr-figure-clip {
    display: grid;
    place-items: center;
    flex: 1 1 0;
    min-width: 0;
    height: 34px;
    border-radius: 6px;
    font-weight: 700;
}
.mtr-figure-clip.a { margin-right: 1px; background: #4c5f8a; }
.mtr-figure-clip.b { margin-left: 1px; background: #b0704b; }
.mtr-figure-clip.fx {
    position: relative;
    display: flex;
    flex: 0 0 44%;
    margin: 0 auto;
    overflow: hidden;
    color: var(--mtr-ink);
}
.mtr-figure-clip.fx i { height: 100%; }
.mtr-figure-clip.fx .in { flex: 13 1 0; background: var(--mtr-in); }
.mtr-figure-clip.fx .hold { flex: 4 1 0; background: var(--mtr-hold); }
.mtr-figure-clip.fx .out { flex: 13 1 0; background: var(--mtr-out); }
.mtr-figure-clip.fx b {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 11.5px;
    white-space: nowrap;
}
.mtr-figure-cut {
    margin: 4px 0 0 calc(6.4em + 10px);
    color: #ffd93d !important;
    font-size: 12px !important;
    line-height: 1.6 !important;
    text-align: center;
}
.mtr-table-wrap {
    margin-top: 14px;
    overflow-x: auto;
    border: 1px solid var(--mtr-line);
    border-radius: 14px;
}
.mtr-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 13.5px;
    line-height: 1.75;
}
.mtr-table th, .mtr-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--mtr-line);
    text-align: left;
    vertical-align: top;
}
.mtr-table thead th { background: var(--mtr-soft); font-size: 12.5px; }
.mtr-table tbody th { white-space: nowrap; }
.mtr-table tbody tr:last-child th, .mtr-table tbody tr:last-child td { border-bottom: 0; }
.mtr-table small { color: var(--text-sub); font-weight: 500; }

.faq-list {
    overflow: hidden;
    border: 1px solid #eee;
    border-radius: 16px;
}
.faq-list details { border-bottom: 1px solid #eee; }
.faq-list details:last-child { border: 0; }
.faq-list summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::before {
    content: 'Q';
    color: var(--primary-color);
    font-size: 18px;
}
.faq-list summary::after {
    content: '+';
    margin-left: auto;
    color: #666;
    font-size: 20px;
}
.faq-list details[open] { background: var(--bg-light); }
.faq-list details[open] summary::after { content: '−'; }
.faq-list p {
    margin: 0 20px 20px 46px;
    color: #666;
    font-size: 13px;
    line-height: 1.9;
}
.mtr-related-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 24px;
    margin-top: 28px;
    color: #007ea9;
    font-size: 13px;
}
.mtr-related-links a { text-decoration: underline; }

/* ---------- 画面の高さが足りないときは、プレビューを固定しない ---------- */
@media (max-height: 560px) {
    .mtr-stage { position: static; }
}

/* ---------- タブレット以上 ---------- */
@media (min-width: 620px) {
    .mtr-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .mtr-steps li { flex-direction: column; gap: 8px; }
    .mtr-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
    .mtr-next-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .mtr-chips, .mtr-swatches { flex-wrap: wrap; overflow: visible; }
    .mtr-time-row { grid-template-columns: 10.5em minmax(0, 1fr) 8.4em; }
    .mtr-stepper { grid-column: auto; }
    .mtr-round span { display: inline; }
    .mtr-round { width: auto; padding: 0 16px; }
    .mtr-round#sample { width: 44px; padding: 0; }
    .mtr-round i { font-size: 12px; }
    .mtr-sizes { flex: 0 1 auto; margin-left: auto; }
    .mtr-sizes button { padding: 0 12px; }
}

/* ---------- PC：左に 1・2・文字ロゴ・詳細設定、右にプレビューと保存を固定表示 ---------- */
@media (min-width: 980px) {
    .mtr-intro { padding-top: 34px; padding-bottom: 20px; }
    .mtr-app {
        grid-template-columns: minmax(0, 1fr) minmax(0, 430px);
        gap: 18px 26px;
        align-items: start;
    }
    .mtr-main { grid-column: 1; grid-row: 1; gap: 18px; }
    .mtr-app > .mtr-details { grid-column: 1; grid-row: 2; }
    .mtr-stage {
        grid-column: 2;
        grid-row: 1 / span 2;
        top: 98px;
        margin: 0;
        padding: 12px;
        border: 1px solid var(--mtr-line);
        box-shadow: 0 10px 30px rgba(0, 0, 0, .05);
    }
    /* 保存はプレビューのすぐ下に固定する。画面の高さに収まらないぶんは、カードの中でスクロールする */
    .mtr-save-card {
        grid-column: 2;
        grid-row: 1 / span 2;
        position: sticky;
        top: calc(98px + var(--mtr-stage-h) + 14px);
        margin-top: calc(var(--mtr-stage-h) + 14px);
        max-height: max(220px, calc(100vh - 98px - var(--mtr-stage-h) - 26px));
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    /* 保存ボタンは、カードの中をスクロールしても下に残す */
    .mtr-save-row {
        position: sticky;
        bottom: -20px;
        z-index: 2;
        margin: 0 -20px;
        padding: 12px 20px 14px;
        background: linear-gradient(rgba(255, 255, 255, 0), #fff 12px);
    }
    .mtr-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
    .mtr-card { padding: 20px; }
    .mtr-chips { margin: 0 0 10px; padding: 0; }
    .mtr-swatches { margin: 0; padding: 3px; }
    .mtr-shelf { margin: 0 -20px; padding: 2px 20px 8px; }
    .mtr-details { padding: 0; }
    .mtr-details-body { padding: 0 20px 20px; }
    .mtr-details summary { padding: 16px 48px 16px 20px; }
    .mtr-round span { display: none; }
    .mtr-round, .mtr-round#sample { width: 44px; padding: 0; }
    .mtr-round i { font-size: 13px; }
    .mtr-sizes { flex: 1 1 auto; margin-left: 0; }
    .mtr-sizes button { padding: 0 2px; }
    .mtr-next-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 980px) and (max-height: 620px) {
    .mtr-stage, .mtr-save-card { position: static; }
    .mtr-save-card { max-height: none; overflow: visible; }
    .mtr-save-row { position: static; }
}

@media (hover: hover) {
    .mtr-chip-btn:hover, .mtr-seg button:not(:disabled):hover, .mtr-round:hover, .mtr-chips button:hover,
    .mtr-shortcuts button:hover, .mtr-pad button:hover, .mtr-origin button:hover, .mtr-stepper button:not(:disabled):hover { border-color: var(--primary-color); }
    .mtr-seg button[aria-pressed="true"]:hover { border-color: var(--primary-hover); }
    .mtr-chips button[aria-pressed="true"]:hover, .mtr-round.mtr-replay:hover { border-color: var(--mtr-ink); }
    .mtr-preset:hover { border-color: #9fdcf5; }
    .mtr-preset[aria-pressed="true"]:hover { border-color: var(--primary-color); }
    .mtr-swatches button:hover { transform: scale(1.06); }
    .mtr-item-tools button:hover { background: var(--mtr-soft); color: var(--text-main); }
    .mtr-item-tools button[data-sure="true"]:hover { background: #c53030; color: #fff; }
}

@media (prefers-reduced-motion: reduce) {
    .loading-bars span { animation-duration: 2.4s; }
    .mtr *, .mtr *::after { transition: none !important; }
}
