/* Public mobile listener — accessibility-first */

body.mobile-app {
    --ma-ink: #0b1520;
    --ma-muted: #3d4d5a;
    --ma-card: #ffffff;
    --ma-card-border: #8f9f94;
    --ma-card-active: #d7efe8;
    --ma-card-active-border: #0d6b5c;
    --ma-track: #c5d0c9;
    --ma-track-fill: #0d6b5c;
    --ma-focus: #0a4f44;
    min-height: 100vh;
    min-height: 100dvh;
    font-size: 112.5%;
    line-height: 1.5;
    color: var(--ma-ink);
    background:
        radial-gradient(700px 360px at 50% -10%, rgba(13, 107, 92, 0.14), transparent 55%),
        linear-gradient(180deg, #f2f6f3 0%, var(--bg) 45%, #e0e8e3 100%);
}

.ma-visually-hidden,
.ma-skip:not(:focus):not(:focus-visible) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.ma-skip:focus,
.ma-skip:focus-visible {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 100;
    width: auto;
    height: auto;
    margin: 0;
    clip: auto;
    padding: 0.75rem 1rem;
    background: #000;
    color: #fff;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
}

.ma *:focus {
    outline: none;
}
.ma *:focus-visible {
    outline: 3px solid var(--ma-focus);
    outline-offset: 3px;
}

.ma {
    width: min(40rem, 100%);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding:
        max(0.75rem, env(safe-area-inset-top))
        max(1rem, env(safe-area-inset-right))
        max(1.25rem, env(safe-area-inset-bottom))
        max(1rem, env(safe-area-inset-left));
}

.ma-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.ma-brand {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ma-ink);
}

.ma-site {
    margin: 0.25rem 0 0;
    font-size: 1rem;
    color: var(--ma-muted);
    font-weight: 600;
}

.ma-lang {
    position: relative;
    flex: 0 0 auto;
}

.ma-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.75rem;
    min-width: 2.75rem;
    padding: 0.45rem 0.75rem;
    border: 2px solid var(--ma-card-border);
    border-radius: 999px;
    background: var(--ma-card);
    color: var(--ma-ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.ma-lang-flag {
    font-size: 1.25rem;
    line-height: 1;
}

.ma-lang-code {
    font-size: 0.9rem;
    letter-spacing: 0.04em;
}

.ma-lang-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 30;
    min-width: 12rem;
    padding: 0.4rem;
    border: 2px solid var(--ma-card-border);
    border-radius: var(--radius-sm);
    background: var(--ma-card);
    box-shadow: var(--shadow);
}
.ma-lang.is-open .ma-lang-menu {
    display: block;
}

.ma-lang-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.4rem 0.6rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ma-ink);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.ma-lang-option:hover,
.ma-lang-option[aria-selected="true"] {
    background: var(--accent-soft);
}

.ma-main {
    flex: 1 1 auto;
}

.ma-status {
    margin: 0;
    font-size: 1.1rem;
    color: var(--ma-ink);
    line-height: 1.45;
}

.ma-btn {
    appearance: none;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    min-height: 3rem;
    padding: 0.75rem 1.15rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.75rem;
}

.ma-btn.primary {
    background: var(--accent);
    color: var(--accent-ink);
}

.ma-label {
    display: block;
    margin: 0 0 0.4rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ma-ink);
}

.ma-select {
    width: 100%;
    min-height: 3rem;
    padding: 0.55rem 0.75rem;
    border: 2px solid var(--ma-card-border);
    border-radius: var(--radius-sm);
    background: var(--ma-card);
    color: var(--ma-ink);
    font: inherit;
    font-weight: 600;
}

.ma-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ma-item {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.ma-item article {
    padding: 1rem 1rem 1.05rem;
    border: 2px solid var(--ma-card-border);
    border-radius: var(--radius);
    background: var(--ma-card);
    box-shadow: 0 1px 0 rgba(20, 32, 41, 0.06);
}

.ma-item.is-active article {
    border-color: var(--ma-card-active-border);
    background: var(--ma-card-active);
    box-shadow: 0 0 0 1px var(--ma-card-active-border);
}

.ma-item-time {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ma-ink);
}

.ma-timeline {
    margin: 0 0 0.75rem;
}

.ma-times {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ma-muted);
}

.ma-seek {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 1.75rem;
    margin: 0;
    background: transparent;
    cursor: pointer;
}
.ma-seek:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.ma-seek::-webkit-slider-runnable-track {
    height: 0.55rem;
    border-radius: 999px;
    background: var(--ma-track);
    border: 1px solid #8a9a90;
}
.ma-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.35rem;
    height: 1.35rem;
    margin-top: -0.42rem;
    border-radius: 50%;
    background: var(--ma-track-fill);
    border: 2px solid #063f37;
    box-shadow: 0 0 0 2px #fff;
}
.ma-seek::-moz-range-track {
    height: 0.55rem;
    border-radius: 999px;
    background: var(--ma-track);
    border: 1px solid #8a9a90;
}
.ma-seek::-moz-range-thumb {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: var(--ma-track-fill);
    border: 2px solid #063f37;
}

.ma-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.55rem;
}

.ma-ctrl {
    appearance: none;
    border: 2px solid var(--ma-card-border);
    border-radius: var(--radius-sm);
    min-height: 3rem;
    padding: 0.4rem 0.3rem;
    background: #fff;
    color: var(--ma-ink);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.ma-ctrl.primary {
    background: var(--accent);
    border-color: #085549;
    color: var(--accent-ink);
}

.ma-linkish {
    appearance: none;
    border: 0;
    background: transparent;
    color: #085549;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    min-height: 2.5rem;
    padding: 0.35rem 0;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.ma-transcript {
    margin-top: 0.45rem;
    padding: 0.85rem 0.9rem;
    border-radius: var(--radius-sm);
    background: #fff;
    border: 2px solid var(--ma-card-border);
    color: var(--ma-ink);
    font-size: 1.05rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

@media (max-width: 360px) {
    .ma-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .ma *,
    .ma *::before,
    .ma *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-contrast: more) {
    body.mobile-app {
        --ma-ink: #000;
        --ma-muted: #000;
        --ma-card: #fff;
        --ma-card-border: #000;
        --ma-card-active: #fff;
        --ma-card-active-border: #000;
        --ma-track: #777;
        --ma-track-fill: #000;
        --ma-focus: #000;
        background: #fff;
        color: #000;
    }
    .ma-item article,
    .ma-item.is-active article,
    .ma-lang-btn,
    .ma-lang-menu,
    .ma-select,
    .ma-transcript,
    .ma-ctrl {
        border-width: 3px;
        border-color: #000;
        background: #fff;
        box-shadow: none;
    }
    .ma-ctrl.primary,
    .ma-btn.primary {
        background: #000;
        color: #fff;
        border-color: #000;
    }
    .ma-linkish {
        color: #000;
    }
    .ma-seek::-webkit-slider-thumb,
    .ma-seek::-moz-range-thumb {
        background: #000;
        border-color: #000;
        box-shadow: 0 0 0 2px #fff;
    }
}

@media (forced-colors: active) {
    .ma-item article,
    .ma-lang-btn,
    .ma-ctrl,
    .ma-btn,
    .ma-select,
    .ma-seek {
        border: 2px solid ButtonText;
    }
    .ma-ctrl.primary,
    .ma-btn.primary {
        background: Highlight;
        color: HighlightText;
        border-color: ButtonText;
    }
    .ma *:focus-visible {
        outline: 3px solid Highlight;
    }
}
