body.trail-player-page {
    --trail-ink: #17302b;
    --trail-muted: #60716b;
    --trail-border: rgba(23, 60, 53, 0.14);
    --trail-surface: #ffffff;
    --trail-canvas: #eef2f0;
    --trail-accent: #087c6d;
    --trail-accent-soft: #e7f5f1;
    background: var(--trail-canvas);
    color: var(--trail-ink);
}

.trail-player-main {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 34px 0 52px;
}

.trail-player {
    overflow: hidden;
    border: 1px solid var(--trail-border);
    border-radius: 10px;
    background: var(--trail-surface);
    box-shadow: 0 8px 28px rgba(18, 39, 34, 0.08);
}

.trail-player-header {
    padding: 25px 30px 20px;
}

.trail-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(23, 60, 53, 0.09);
}

.trail-context-primary {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.trail-context-mark {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 8px;
    background: var(--trail-accent-soft);
    color: var(--trail-accent);
    font-size: 1.4rem;
    font-weight: 700;
}

.trail-context-kicker,
.trail-item-type,
.trail-activity-eyebrow {
    color: var(--trail-accent);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
}

.trail-context-owner {
    margin: 2px 0 0;
    color: var(--trail-ink);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
}

.trail-context-date {
    flex: 0 0 auto;
    color: var(--trail-muted);
    font-size: 0.875rem;
}

.trail-item-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 20px;
    padding-top: 20px;
}

.trail-item-type {
    grid-column: 1 / -1;
    width: fit-content;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--trail-accent-soft);
}

.trail-item-heading h2 {
    min-width: 0;
    margin: 0;
    color: var(--trail-ink);
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.24;
    overflow-wrap: anywhere;
}

.trail-item-meta {
    grid-column: 1;
    color: var(--trail-muted);
    font-size: 0.875rem;
    line-height: 1.45;
}

.trail-primary-action {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    border: 1px solid var(--trail-accent);
    border-radius: 5px;
    background: var(--trail-accent);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}

.trail-primary-action:hover,
.trail-primary-action:focus {
    border-color: #045c51;
    background: #045c51;
    color: #ffffff;
    text-decoration: none;
}

.trail-item-heading > .trail-primary-action {
    grid-column: 2;
    grid-row: 2 / span 2;
    white-space: nowrap;
}

.trail-primary-action:focus-visible,
.trail-nav-button:focus-visible {
    outline: 3px solid rgba(8, 124, 109, 0.35);
    outline-offset: 2px;
}

.trail-progress {
    display: grid;
    grid-template-columns: auto minmax(80px, 1fr);
    align-items: center;
    gap: 14px;
    margin-top: 19px;
}

.trail-progress-label {
    color: var(--trail-muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.trail-progress-track {
    height: 4px;
    overflow: hidden;
    border-radius: 99px;
    background: #e5ece9;
}

.trail-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--trail-accent);
    transition: width 180ms ease;
}

.trail-iframe-wrap {
    width: 100%;
    height: min(66vh, 740px);
    min-height: 420px;
    overflow: hidden;
    background: #e8eeeb;
}

.trail-iframe-wrap iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #ffffff;
}

.trail-activity-panel {
    display: grid;
    min-height: 420px;
    grid-template-columns: 64px minmax(0, 620px);
    align-content: center;
    justify-content: center;
    gap: 20px;
    padding: 44px 28px;
    background-color: #f4f8f6;
    background-image: linear-gradient(135deg, rgba(231, 245, 241, 0.8), rgba(255, 255, 255, 0.94));
}

.trail-activity-symbol {
    display: grid;
    width: 64px;
    height: 64px;
    place-items: center;
    border: 1px solid rgba(8, 124, 109, 0.18);
    border-radius: 8px;
    background: #ffffff;
    color: var(--trail-accent);
    font-size: 2rem;
    font-weight: 700;
}

.trail-activity-copy h3 {
    margin: 7px 0 9px;
    color: var(--trail-ink);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.trail-activity-copy p {
    max-width: 54ch;
    margin: 0 0 18px;
    color: var(--trail-muted);
    font-size: 1rem;
    line-height: 1.55;
}

.trail-controls {
    display: grid;
    min-height: 72px;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid var(--trail-border);
    background: #ffffff;
}

.trail-nav-button {
    display: inline-flex;
    min-width: 112px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 13px;
    border: 1px solid var(--trail-border);
    border-radius: 5px;
    background: #ffffff;
    color: var(--trail-ink);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.trail-nav-button:hover:not(:disabled) {
    border-color: var(--trail-accent);
    background: var(--trail-accent-soft);
}

.trail-nav-button:disabled {
    color: #899590;
    cursor: not-allowed;
    opacity: 0.62;
}

.trail-nav-next {
    justify-self: end;
}

.trail-controls-position {
    color: var(--trail-muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

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

@media (max-width: 640px) {
    .trail-player-main {
        width: calc(100% - 24px);
        padding: 14px 0 20px;
    }

    .trail-player {
        border-radius: 8px;
    }

    .trail-player-header {
        padding: 17px 16px 15px;
    }

    .trail-context {
        align-items: flex-start;
        padding-bottom: 13px;
    }

    .trail-context-mark {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .trail-context-date {
        max-width: 42%;
        padding-top: 4px;
        text-align: right;
        overflow-wrap: anywhere;
    }

    .trail-item-heading {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding-top: 16px;
    }

    .trail-item-heading h2 {
        font-size: 1.3rem;
    }

    .trail-item-meta {
        grid-column: 1;
    }

    .trail-item-heading > .trail-primary-action {
        grid-column: 1;
        grid-row: auto;
        justify-self: start;
        margin-top: 3px;
    }

    .trail-progress {
        gap: 10px;
        margin-top: 14px;
    }

    .trail-iframe-wrap {
        height: min(51dvh, 500px);
        min-height: 280px;
    }

    .trail-activity-panel {
        min-height: min(51dvh, 500px);
        grid-template-columns: 44px minmax(0, 1fr);
        align-content: center;
        gap: 13px;
        padding: 26px 18px;
    }

    .trail-activity-symbol {
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }

    .trail-activity-copy h3 {
        font-size: 1.2rem;
    }

    .trail-activity-copy p {
        font-size: 0.92rem;
    }

    .trail-controls {
        position: sticky;
        bottom: 0;
        min-height: 70px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    }

    .trail-controls-fixed .trail-controls {
        position: fixed;
        z-index: 1030;
        right: 0;
        bottom: 0;
        left: 0;
        box-shadow: 0 -5px 18px rgba(18, 39, 34, 0.12);
    }

    .trail-nav-button {
        min-width: 0;
        min-height: 46px;
        padding: 0 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .trail-progress-track span {
        transition: none;
    }
}

html[data-ui-theme="dark"] body.trail-player-page {
    --trail-ink: #e6e9ed;
    --trail-muted: var(--sn-muted);
    --trail-border: var(--sn-border);
    --trail-surface: var(--sn-surface);
    --trail-canvas: var(--sn-canvas);
    --trail-accent: #75e2d2;
    --trail-accent-soft: rgba(0, 191, 166, 0.14);
    background: var(--trail-canvas);
    color: var(--trail-ink);
}

html[data-ui-theme="dark"] body.trail-player-page .trail-player {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
}

html[data-ui-theme="dark"] body.trail-player-page .trail-context {
    border-bottom-color: var(--trail-border);
}

html[data-ui-theme="dark"] body.trail-player-page .trail-primary-action {
    border-color: #087c6d;
    background: #087c6d;
    color: #fff;
}

html[data-ui-theme="dark"] body.trail-player-page .trail-primary-action:hover,
html[data-ui-theme="dark"] body.trail-player-page .trail-primary-action:focus {
    border-color: #0a927e;
    background: #0a927e;
    color: #fff;
}

html[data-ui-theme="dark"] body.trail-player-page .trail-primary-action:active {
    border-color: #066b5c;
    background: #066b5c;
}

html[data-ui-theme="dark"] body.trail-player-page .trail-primary-action:focus-visible,
html[data-ui-theme="dark"] body.trail-player-page .trail-nav-button:focus-visible {
    outline-color: rgba(117, 226, 210, 0.55);
}

html[data-ui-theme="dark"] body.trail-player-page .trail-progress-track {
    background: #454d55;
}

html[data-ui-theme="dark"] body.trail-player-page .trail-iframe-wrap {
    background: var(--sn-band);
}

html[data-ui-theme="dark"] body.trail-player-page .trail-iframe-wrap iframe {
    background: var(--sn-surface);
}

html[data-ui-theme="dark"] body.trail-player-page .trail-activity-panel {
    background-color: var(--sn-surface);
    background-image: linear-gradient(135deg, rgba(48, 54, 61, 0.82), rgba(42, 47, 54, 0.96));
}

html[data-ui-theme="dark"] body.trail-player-page .trail-activity-symbol {
    background: var(--sn-surface-raised);
    border-color: var(--trail-border);
}

html[data-ui-theme="dark"] body.trail-player-page .trail-controls,
html[data-ui-theme="dark"] body.trail-player-page .trail-nav-button {
    background: var(--sn-surface-raised);
}

html[data-ui-theme="dark"] body.trail-player-page .trail-nav-button:hover:not(:disabled),
html[data-ui-theme="dark"] body.trail-player-page .trail-nav-button:active:not(:disabled) {
    border-color: var(--trail-accent);
    background: rgba(0, 191, 166, 0.18);
    color: #f4f7f7;
}

html[data-ui-theme="dark"] body.trail-player-page .trail-nav-button:disabled {
    border-color: rgba(255, 255, 255, 0.08);
    color: #7f8993;
}

html[data-ui-theme="dark"] body.trail-player-page.trail-controls-fixed .trail-controls {
    box-shadow: 0 -5px 18px rgba(0, 0, 0, 0.38);
}
