/* MIDI to WAV converter. Same look as the seamless loop maker: the simpleSPU page's
   stickers, keys and tags (/simplespu/retro.css), as three numbered steps. */

.m2w-page [hidden] { display: none !important; }

/* ── Intro ── */
main > section.m2w-intro {
    display: grid;
    justify-items: start;
    gap: 16px;
    max-width: 860px;
    padding-bottom: 32px;
}

.m2w-intro .section-text { max-width: 40em; }

/* ── The three steps ── */
main > section.m2w-app {
    display: grid;
    gap: 22px;
    max-width: 860px;
    padding-top: 0;
}

.m2w-step {
    display: grid;
    gap: 18px;
    padding: 24px 28px;
    transition: opacity 0.2s ease;
}

/* Step 3 waits for a MIDI file and a SoundFont. */
.m2w-step.is-locked { opacity: 0.45; }
.m2w-step.is-locked .m2w-more { display: none; }

.m2w-step-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.m2w-step-head h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }

.m2w-step-num {
    display: grid;
    flex: none;
    place-items: center;
    width: 42px;
    height: 42px;
    font: 400 1.25rem/1 var(--font-display);
    color: var(--ink);
    background: var(--accent);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
    box-shadow: 0 3px 0 var(--ink);
}

#m2w-step-sound .m2w-step-num { background: var(--teal-light); }
#m2w-step-render .m2w-step-num { background: var(--cream); }

/* ── Step 1: drop zone ── */
.m2w-drop {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 26px 20px;
    text-align: center;
    background: var(--panel-raised);
    border: var(--line) dashed var(--ink);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.m2w-drop.is-dragging { background: var(--teal-light); }

.m2w-drop-title { font-weight: 700; font-size: 1.1rem; }

.m2w-drop-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* Once a file is in, the drop zone shrinks to a "change file" strip. */
.m2w-drop.is-compact {
    grid-template-columns: minmax(0, 1fr) auto;
    justify-items: start;
    align-items: center;
    padding: 12px 16px;
    text-align: left;
}

.m2w-drop.is-compact .m2w-drop-title { font-size: 1rem; }

.m2w-loaded {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.m2w-loaded::before {
    content: "";
    flex: none;
    width: 14px;
    height: 12px;
    margin-top: 0.35em;
    background: var(--ok);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 6'%3E%3Cpath d='M6 0h1v1H6zM5 1h2v1H5zM0 2h1v1H0zM4 2h2v1H4zM0 3h2v1H0zM3 3h2v1H3zM1 4h3v1H1zM2 5h1v1H2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.m2w-loaded[data-busy]::before { background: var(--muted); }

.m2w-note {
    padding: 12px 14px;
    font-weight: 500;
    background: var(--cream);
    color: var(--ink);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
}

.m2w-note[data-tone="error"] { background: #ffd9cb; }

/* ── Step 2: SoundFont choice ── */
/* No SoundFont added means General MIDI; this strip shows that, or switches back to it. */
.m2w-gm {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    font: inherit;
    text-align: left;
    color: var(--text);
    background: var(--panel-raised);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
    cursor: pointer;
}

.m2w-gm[aria-pressed="true"] {
    background: var(--teal-light);
    color: var(--ink);
    box-shadow: 0 3px 0 var(--ink);
    cursor: default;
}

.m2w-gm-mark {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 3px;
    border: var(--line) solid var(--ink);
    border-radius: 50%;
    background: var(--cream);
}

.m2w-gm[aria-pressed="true"] .m2w-gm-mark { background: var(--accent); box-shadow: inset 0 0 0 3px var(--cream); }

.m2w-gm-text { display: grid; gap: 4px; }
.m2w-gm-text span { font-size: 0.93rem; color: var(--muted); }
.m2w-gm[aria-pressed="true"] .m2w-gm-text span { color: inherit; opacity: 0.8; }

/* ── Step 3: convert ── */
.m2w-render-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.m2w-convert { font-size: 1.1rem; padding: 15px 26px 14px; }

.m2w-format select {
    height: 100%;
    font: 700 1rem/1.2 var(--font-body);
    color: var(--ink);
    background: var(--cream);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
    padding: 10px 12px 9px;
    box-shadow: 0 4px 0 var(--ink);
}

.m2w-progress { display: grid; gap: 8px; }

.m2w-progress-bar {
    height: 22px;
    overflow: hidden;
    border: var(--line) solid var(--ink);
    border-radius: 8px;
    background: var(--track);
}

.m2w-progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--teal);
    transition: width 0.15s linear;
}

.m2w-progress-text {
    color: var(--muted);
    font-size: 0.93rem;
    font-variant-numeric: tabular-nums;
}

.m2w-result {
    display: grid;
    gap: 12px;
    padding: 12px 16px 16px;
}

.m2w-result audio { width: 100%; }

.m2w-result-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}

.m2w-download { font-size: 1.05rem; }
.m2w-download .btn-icon { width: 18px; height: 18px; }
.m2w-result-info { font-size: 0.93rem; opacity: 0.85; }

/* ── Details: export settings out of the way ── */
.m2w-more {
    border-top: var(--line) dashed var(--dim);
    padding-top: 14px;
}

.m2w-more > summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.m2w-more > summary::-webkit-details-marker { display: none; }

.m2w-more > summary::before {
    content: "";
    width: 10px;
    height: 10px;
    background: currentColor;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    transition: transform 0.15s ease;
}

.m2w-more[open] > summary::before { transform: rotate(90deg); }

.m2w-more-body {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 14px;
}

.m2w-field {
    display: grid;
    gap: 6px;
    font-weight: 500;
    font-size: 0.95rem;
}

.m2w-field select {
    min-width: 180px;
    font: 700 1rem/1.2 var(--font-body);
    color: var(--ink);
    background: var(--cream);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
    padding: 10px 12px 9px;
    box-shadow: 0 4px 0 var(--ink);
}

/* ── simpleSF2, one compact card ── */
main > section.m2w-cta {
    max-width: 860px;
    padding-top: 12px;
}

.m2w-cta-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px 18px;
    align-items: start;
    padding: 22px 24px;
}

.m2w-cta-card img { width: 56px; height: 56px; }
.m2w-cta-text h2 { font-size: clamp(1.15rem, 2.2vw, 1.4rem); }
.m2w-cta-text p { margin-top: 6px; color: var(--muted); }

.m2w-cta-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}

.m2w-cta-more,
.m2w-guides a,
.faq-card a { color: var(--link); font-weight: 700; }

.m2w-cta-more { font-size: 0.95rem; }

.m2w-guides { margin-top: 28px; color: var(--muted); }

@media (max-width: 640px) {
    .m2w-step { padding: 20px; gap: 16px; }
    .m2w-step-num { width: 36px; height: 36px; font-size: 1.05rem; }
    .m2w-drop { padding: 22px 16px; }
    .m2w-drop-actions, .m2w-drop-actions > * { width: 100%; }
    .m2w-drop.is-compact { grid-template-columns: minmax(0, 1fr); }
    .m2w-convert, .m2w-download, .m2w-format, .m2w-format select { width: 100%; justify-content: center; }
    .m2w-cta-card { padding: 20px; }
    .m2w-cta-actions > .button, .m2w-cta-actions > .platform-download { width: 100%; }
}

.m2w-check {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-basis: 100%;
    font-weight: 500;
}

.m2w-check input { width: 20px; height: 20px; accent-color: var(--accent); }
