/* The share + embed sheet — one dialog, three players.
 *
 * ⚠️ THIS STYLESHEET LANDS IN THREE FOREIGN DOCUMENTS: tune.php's chassis, NOVA's app shell and
 * radio3d.php's WebGL page, each with its own reset, its own font stack and its own idea of what
 * a <button> looks like. So every rule is scoped under .msh-, every property a host page might
 * already have opinions about is stated outright (box-sizing, font, line-height, margin), and
 * the colours are tokens on .msh-root rather than :root — three different :root palettes are
 * exactly what a shared component must not inherit from.
 */

.msh-root {
    --msh-ink: #e8f1ff;
    --msh-dim: #93a7c4;
    --msh-ground: #0d1426;
    --msh-raise: #141d33;
    --msh-line: rgba(255, 255, 255, .10);
    --msh-accent: #00d4ff;
    --msh-accent-soft: rgba(0, 212, 255, .14);
    --msh-ok: #34d399;
    position: fixed;
    inset: 0;
    z-index: 2147483100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 7, 16, .72);
    backdrop-filter: blur(4px);
    font: 400 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--msh-ink);
    box-sizing: border-box;
}
.msh-root.msh-on { display: flex }
.msh-root *, .msh-root *::before, .msh-root *::after { box-sizing: border-box }

.msh-box {
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow: auto;
    background: linear-gradient(180deg, var(--msh-raise), var(--msh-ground));
    border: 1px solid var(--msh-line);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
    padding: 18px 18px 16px;
    animation: msh-in .18s ease-out;
}
@keyframes msh-in { from { opacity: 0; transform: translateY(8px) scale(.99) } }
@media (prefers-reduced-motion: reduce) { .msh-box { animation: none } }

.msh-head { display: flex; align-items: center; gap: 10px; margin: 0 0 4px }
.msh-title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .01em; flex: 1 }
.msh-x {
    flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; cursor: pointer;
    border: 1px solid var(--msh-line); background: rgba(255, 255, 255, .04);
    color: var(--msh-dim); font-size: 17px; line-height: 1; padding: 0;
}
.msh-x:hover { color: var(--msh-ink); background: rgba(255, 255, 255, .08) }

.msh-sub { margin: 0 0 12px; color: var(--msh-dim); font-size: 12.5px }

.msh-tabs { display: flex; gap: 6px; margin: 0 0 14px }
.msh-tab {
    flex: 1; padding: 9px 10px; border-radius: 10px; cursor: pointer; font: inherit;
    font-weight: 600; font-size: 13px; color: var(--msh-dim);
    border: 1px solid var(--msh-line); background: rgba(255, 255, 255, .03);
}
.msh-tab[aria-selected="true"] {
    color: #fff; border-color: rgba(0, 212, 255, .45); background: var(--msh-accent-soft);
}

.msh-panel { display: none }
.msh-panel.msh-show { display: block }

.msh-lbl {
    display: block; margin: 0 0 6px; font-size: 11.5px; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase; color: var(--msh-dim);
}

.msh-row { display: flex; gap: 8px; align-items: stretch }
.msh-field {
    flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--msh-line); background: rgba(0, 0, 0, .28);
    color: var(--msh-ink); font: inherit; font-size: 13px;
    /* A link is read left-to-right even in Persian — the RTL page must not reverse it. */
    direction: ltr; text-align: start;
}
.msh-field:focus { outline: 2px solid var(--msh-accent); outline-offset: 1px }

.msh-btn {
    flex: 0 0 auto; padding: 10px 15px; border-radius: 10px; cursor: pointer;
    font: inherit; font-weight: 700; font-size: 13px; white-space: nowrap;
    border: 1px solid rgba(0, 212, 255, .45); background: var(--msh-accent-soft);
    color: #bfefff; transition: background .15s, color .15s;
}
.msh-btn:hover { background: rgba(0, 212, 255, .24); color: #fff }
.msh-btn.msh-done { border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .18); color: #a7f3d0 }

.msh-wide { display: block; width: 100%; margin-top: 8px; text-align: center }

.msh-dests { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px }
.msh-dest {
    display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px;
    border-radius: 999px; border: 1px solid var(--msh-line);
    background: rgba(255, 255, 255, .03); color: var(--msh-ink);
    font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.msh-dest:hover { background: rgba(255, 255, 255, .08) }
.msh-dest svg { width: 15px; height: 15px; flex: 0 0 auto }

.msh-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 14px }
.msh-chip {
    padding: 7px 13px; border-radius: 999px; cursor: pointer; font: inherit;
    font-size: 12.5px; font-weight: 600; color: var(--msh-dim);
    border: 1px solid var(--msh-line); background: rgba(255, 255, 255, .03);
}
.msh-chip[aria-pressed="true"] {
    color: #fff; border-color: rgba(0, 212, 255, .45); background: var(--msh-accent-soft);
}
.msh-chip[disabled] { opacity: .38; cursor: not-allowed }

.msh-prev {
    border: 1px solid var(--msh-line); border-radius: 12px; overflow: hidden;
    background: #05070f; margin: 0 0 12px;
    /* The preview is a real frame at a real ratio, scaled to the sheet — a still image would
       let a broken size ship. Height comes from the chosen preset, set inline by the script. */
}
.msh-prev iframe { display: block; width: 100%; height: 100%; border: 0 }

.msh-code {
    width: 100%; min-height: 84px; resize: vertical; padding: 11px 12px;
    border-radius: 10px; border: 1px solid var(--msh-line); background: rgba(0, 0, 0, .34);
    color: #bfe6ff; font: 400 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    direction: ltr; text-align: start; white-space: pre-wrap; word-break: break-all;
}
.msh-code:focus { outline: 2px solid var(--msh-accent); outline-offset: 1px }

.msh-note { margin: 10px 0 0; font-size: 11.5px; color: var(--msh-dim) }

@media (max-width: 520px) {
    .msh-root { padding: 12px }
    .msh-box { padding: 15px 14px 14px; border-radius: 15px }
    .msh-dest { padding: 7px 10px }
}
