
.sfm-app {
    max-width: 760px;
    margin: 0 auto;
    font-family: Roboto, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #161616;
}
.sfm-list { display: grid; gap: 14px; }
.sfm-meditation-card {
    border: 1px solid #e1e1e1;
    border-radius: 18px;
    padding: 18px 20px;
    background: #fff;
}
.sfm-meditation-card h3 { margin: 0 0 8px; font-size: 1.25rem; }
.sfm-meditation-card p { margin: 0 0 14px; color: #666; line-height: 1.65; }
.sfm-card-meta { color: #777; font-size: .95rem; margin-bottom: 14px; }

.sfm-session-view {
    position: relative;
    padding: 16px 8px 18px;
}
.sfm-session-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.sfm-menu-btn {
    min-width: 38px;
    height: 38px;
    border: 0;
    background: transparent;
    color: #222;
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
    padding: 0;
    border-radius: 50%;
}
.sfm-menu-btn:focus-visible { outline: 2px solid #2f8f57; outline-offset: 2px; }

.sfm-timer-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 25vh;
    margin: -8px 0 34px;
    text-align: center;
}
.sfm-timer {
    font-family: "Noto Serif KR", serif;
    font-weight: 500;
    font-size: 22px;
    line-height: 1;
    color: #4169E1;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    display: inline-block;
    min-width: 5.2ch;
    white-space: nowrap;
    text-align: center;
}

.sfm-player-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin: 22px 0 10px;
}
.sfm-session-head {
    flex: 1;
    min-width: 0;
    text-align: left;
}
.sfm-session-head h2 {
    margin: 0;
    font-family: Roboto, "Noto Sans KR", sans-serif;
    font-size: 1.7rem;
    font-weight: 400;
    line-height: 1.2;
}
.sfm-code {
    margin-top: 6px;
    font-family: Roboto, Arial, sans-serif;
    font-size: 1rem;
    font-weight: 300;
    color: #555;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.sfm-inline-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.sfm-inline-btn {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(185,185,185,.92);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 6px 16px rgba(0,0,0,.10);
    color: #fff;
    padding: 0;
}
.sfm-inline-btn:focus-visible { outline: 2px solid #2f8f57; outline-offset: 3px; }
.sfm-play-icon {
    display: block;
    width: 0;
    height: 0;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    border-left: 17px solid rgba(255,255,255,.98);
    margin-left: 4px;
}
.sfm-pause-icon { display: flex; gap: 6px; }
.sfm-pause-icon i {
    display: block;
    width: 6px;
    height: 22px;
    border-radius: 3px;
    background: rgba(255,255,255,.98);
}

.sfm-progress-wrap {
    display: flex;
    flex-direction: column;
    margin: 12px 0 22px;
}
.sfm-progress-track {
    order: 1;
    position: relative;
    height: 3px;
    border-radius: 999px;
    background: #d6d6d6;
    overflow: visible;
}
.sfm-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    border-radius: 999px;
    background: #2f8f57;
    transition: width .2s linear;
}
.sfm-alarm-markers { position: absolute; inset: 0; pointer-events: none; }
.sfm-alarm-marker {
    position: absolute;
    top: -3px;
    width: 1px;
    height: 9px;
    border-radius: 0;
    background: #ffffff;
    transform: translateX(-0.5px);
    box-shadow: 0 0 0 0.5px rgba(0,0,0,.08);
}

.sfm-reading-block {
    margin: 28px 0 14px;
    text-align: left;
}
.sfm-readings {
    margin: 0;
    padding-left: 1.5em;
}
.sfm-readings li {
    margin-bottom: 12px;
    line-height: 1.8;
    font-size: 1rem;
}

.sfm-finish-wrap { margin: 16px 0 8px; }
.sfm-finish {
    min-width: 92px;
    min-height: 40px;
    border: 1px solid #9aa0aa;
    border-radius: 16px;
    background: #fff;
    color: #222;
    font-size: .96rem;
    cursor: pointer;
}

.sfm-record-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 18px 0 8px;
}
.sfm-record-save,
.sfm-record-cancel {
    min-width: 132px;
    min-height: 48px;
    border: 0;
    border-radius: 18px;
    padding: 10px 18px;
    background: #e7edf8;
    color: #1f67c2;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(31,103,194,.05);
}
.sfm-record-save:hover,
.sfm-record-cancel:hover {
    filter: brightness(.98);
}

.sfm-status {
    min-height: 24px;
    margin-top: 12px;
    color: #555;
    text-align: center;
}

.sfm-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.28);
    z-index: 9998;
}
.sfm-popup {
    position: fixed;
    right: 18px;
    top: 70px;
    width: min(320px, calc(100vw - 36px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 42px rgba(0,0,0,.18);
    padding: 16px 16px 14px;
    text-align: left;
    z-index: 9999;
}
.sfm-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}
.sfm-popup-close {
    width: 32px;
    height: 32px;
    border: 0;
    background: #f1f1f1;
    border-radius: 50%;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.sfm-popup-section + .sfm-popup-section {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #ececec;
}
.sfm-popup-label {
    font-size: .92rem;
    color: #666;
    margin-bottom: 8px;
}
.sfm-popup-purpose {
    color: #222;
    line-height: 1.72;
    font-size: .98rem;
}
.sfm-switch-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: .98rem;
    color: #444;
    cursor: pointer;
}
.sfm-switch-wrap input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.sfm-switch {
    width: 36px;
    height: 21px;
    border-radius: 999px;
    background: #bdbdbd;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .02em;
    transition: background .2s ease, color .2s ease;
}
.sfm-switch::before { content: "OFF"; }
.sfm-switch-wrap input:checked + .sfm-switch {
    background: #f2c94c;
    color: #493a00;
}
.sfm-switch-wrap input:checked + .sfm-switch::before { content: "ON"; }
.sfm-switch-wrap input:focus-visible + .sfm-switch { outline: 2px solid #d5a900; outline-offset: 3px; }

@media (max-width: 480px) {
    .sfm-app { padding: 0 6px; }
    .sfm-session-view { padding-left: 2px; padding-right: 2px; }
    .sfm-timer-wrap { min-height: 22vh; margin-bottom: 30px; }
    .sfm-timer { font-size: clamp(4.3rem, 22vw, 6.5rem); }
    .sfm-player-row { gap: 12px; }
    .sfm-session-head h2 { font-size: 1.45rem; }
    .sfm-code { font-size: .94rem; }
    .sfm-inline-btn { width: 54px; height: 54px; }
    .sfm-popup {
        right: 12px;
        top: 60px;
        width: calc(100vw - 24px);
    }
}

.sfm-toggle.is-playing .sfm-play-icon {
    width: auto;
    height: auto;
    border: 0;
    margin: 0;
    display: flex;
    gap: 6px;
}
.sfm-toggle.is-playing .sfm-play-icon::before,
.sfm-toggle.is-playing .sfm-play-icon::after {
    content: "";
    display: block;
    width: 6px;
    height: 23px;
    border-radius: 3px;
    background: rgba(255,255,255,.98);
}

.sfm-reading-reveal {
    opacity: 0;
    transform: translateY(-18px);
    max-height: 0;
    overflow: hidden;
}
.sfm-reading-reveal.is-visible {
    animation: sfmWipeDown .8s ease forwards;
    max-height: 1000px;
}
@keyframes sfmWipeDown {
    0% {
        opacity: 0;
        transform: translateY(-18px);
        clip-path: inset(0 0 100% 0);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        clip-path: inset(0 0 0 0);
    }
}
@media (prefers-reduced-motion: reduce) {
    .sfm-reading-reveal,
    .sfm-reading-reveal.is-visible {
        animation: none;
        opacity: 1;
        transform: none;
        clip-path: none;
        max-height: none;
    }
}


/* ===== v0.1.9 overrides ===== */
.sfm-timer {
    font-family: "Roboto Condensed", Roboto, Arial, sans-serif !important;
    font-weight: 500 !important;
    font-size: 22px !important;
    color: #4169E1 !important;
}

.sfm-progress-wrap {
    display: block !important;
    width: 100% !important;
    margin: 12px 0 22px !important;
}

.sfm-progress-track {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: 3px !important;
    background: #d6d6d6 !important;
    border-radius: 999px !important;
    overflow: visible !important;
}

.sfm-progress-fill {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 3px !important;
    background: #2f8f57 !important;
    border-radius: 999px !important;
    transform: scaleX(0);
    transform-origin: left center !important;
    transition: transform .18s linear !important;
    z-index: 1 !important;
}

.sfm-progress-labels {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 16px !important;
    margin: 7px 0 0 !important;
    padding: 0 !important;
    font-family: "Roboto Condensed", Roboto, Arial, sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    color: #555 !important;
}
.sfm-progress-labels .sfm-elapsed-time {
    margin-right: auto !important;
    text-align: left !important;
}
.sfm-progress-labels .sfm-end-time {
    margin-left: auto !important;
    text-align: right !important;
}

.sfm-alarm-markers {
    position: absolute !important;
    inset: 0 !important;
    z-index: 3 !important;
    pointer-events: none !important;
}
.sfm-alarm-marker {
    position: absolute !important;
    top: -2px !important;
    width: 3px !important;
    height: 7px !important;
    background: #fff !important;
    transform: translateX(-1.5px) !important;
    z-index: 4 !important;
    box-shadow: none !important;
}

.sfm-reading-block {
    margin: 30px 0 14px !important;
    text-align: left !important;
    opacity: 1 !important;
    transform: none !important;
    max-height: none !important;
    overflow: visible !important;
    clip-path: none !important;
}

.sfm-read-aloud-badge {
    display: inline-block;
    margin: 0 0 16px 0;
    padding: 4px 10px;
    border: 1px solid #555;
    border-radius: 999px;
    color: #444;
    background: transparent;
    font-family: Roboto, "Noto Sans KR", sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(-8px);
    clip-path: inset(0 0 100% 0);
}

.sfm-reading-block .sfm-readings {
    opacity: 0;
    transform: translateY(-10px);
    clip-path: inset(0 0 100% 0);
}

.sfm-reading-block.show-badge .sfm-read-aloud-badge {
    animation: sfmWipeBadge .55s ease forwards;
}
.sfm-reading-block.show-readings .sfm-readings {
    animation: sfmWipeReadings .8s ease forwards;
}

@keyframes sfmWipeBadge {
    from { opacity: 0; transform: translateY(-8px); clip-path: inset(0 0 100% 0); }
    to { opacity: 1; transform: translateY(0); clip-path: inset(0 0 0 0); }
}
@keyframes sfmWipeReadings {
    from { opacity: 0; transform: translateY(-10px); clip-path: inset(0 0 100% 0); }
    to { opacity: 1; transform: translateY(0); clip-path: inset(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
    .sfm-read-aloud-badge,
    .sfm-reading-block .sfm-readings {
        opacity: 1 !important;
        transform: none !important;
        clip-path: none !important;
        animation: none !important;
    }
}


/* ===== v0.2.0 typography and controls ===== */

/* Remaining time: Roboto Condensed 400 */
.sfm-timer {
    font-family: "Roboto Condensed", Roboto, Arial, sans-serif !important;
    font-weight: 400 !important;
}

/* Timeline: plain Roboto */
.sfm-progress-labels,
.sfm-progress-labels .sfm-elapsed-time,
.sfm-progress-labels .sfm-end-time {
    font-family: Roboto, Arial, sans-serif !important;
    font-weight: 400 !important;
}

/* Read aloud label: slightly larger and rounded-rectangle, not pill */
.sfm-read-aloud-badge {
    font-size: 13px !important;
    padding: 4px 9px !important;
    border: 1px solid #555 !important;
    border-radius: 6px !important;
}

/* Reading text and ordered-list numbers: plain Roboto */
.sfm-readings,
.sfm-readings li {
    font-family: Roboto, "Noto Sans KR", Arial, sans-serif !important;
    font-weight: 400 !important;
}
.sfm-readings li::marker {
    font-family: Roboto, Arial, sans-serif !important;
    font-weight: 400 !important;
}

/* Play/stop control: darker gray */
.sfm-inline-btn {
    background: #666 !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 5px 14px rgba(0,0,0,.12) !important;
}

/* Record buttons: tighter around text */
.sfm-record-actions {
    gap: 8px !important;
}
.sfm-record-save,
.sfm-record-cancel {
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    height: auto !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    font-size: .95rem !important;
    line-height: 1.25 !important;
}

/* No separate Finish control in the simplified play/stop flow */
.sfm-finish-wrap {
    display: none !important;
}


/* ===== v0.2.1 fixes ===== */

/* Remaining time: responsive size for mobile/desktop */
.sfm-timer {
    font-family: "Roboto Condensed", Roboto, Arial, sans-serif !important;
    font-weight: 400 !important;
    font-size: clamp(3.8rem, 11vw, 5rem) !important;
    line-height: 1 !important;
}

/* Hidden elements must actually stay hidden.
   Earlier .sfm-record-actions { display:flex } overrode the HTML hidden state. */
.sfm-record-actions[hidden],
.sfm-finish-wrap[hidden],
.sfm-popup[hidden],
.sfm-popup-backdrop[hidden] {
    display: none !important;
}

/* Only show record actions when JS removes hidden */
.sfm-record-actions:not([hidden]) {
    display: flex !important;
}

@media (max-width: 600px) {
    .sfm-timer {
        font-size: clamp(3.8rem, 17vw, 4.6rem) !important;
    }
}


/* ===== v0.2.2 list and record page ===== */
.sfm-list {
    display: block !important;
}

.sfm-meditation-list-item {
    margin: 0 0 22px;
    padding: 0;
    border: 0;
    background: transparent;
}

.sfm-meditation-title-link {
    display: inline-block;
    margin: 0 0 6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #161616;
    font-family: Roboto, "Noto Sans KR", sans-serif;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
}

.sfm-meditation-title-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sfm-meditation-list-meta {
    font-family: Roboto, Arial, sans-serif;
    font-size: .95rem;
    font-weight: 300;
    color: #666;
    line-height: 1.5;
}

.sfm-status > div + div {
    margin-top: 5px;
}

.sfm-status a {
    color: #4169E1;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sfm-records-page {
    max-width: 760px;
    margin: 0 auto;
    font-family: Roboto, "Noto Sans KR", sans-serif;
}

.sfm-records-title {
    margin: 0 0 24px;
    font-size: 1.5rem;
    font-weight: 400;
}

.sfm-record-item {
    padding: 14px 0;
    border-bottom: 1px solid #e6e6e6;
}

.sfm-record-item-title {
    font-size: 1.05rem;
    font-weight: 400;
}

.sfm-record-item-meta {
    margin-top: 5px;
    color: #666;
    font-size: .92rem;
    font-weight: 300;
}


/* ===== v0.2.3 list/player split ===== */
.sfm-list-page .sfm-meditation-title-link {
    text-decoration: none;
}

.sfm-list-page .sfm-meditation-title-link:hover,
.sfm-list-page .sfm-meditation-title-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sfm-list-page .sfm-meditation-list-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: .42rem;
    row-gap: .2rem;
}

.sfm-meta-dot {
    color: #999;
}

.sfm-entry-count {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    white-space: nowrap;
}

.sfm-fa-play {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: .78em;
    line-height: 1;
}

@media (max-width: 600px) {
    .sfm-list-page .sfm-meditation-list-item {
        margin-bottom: 20px;
    }
}


/* ===== v0.2.9 player layout ===== */
.sfm-player-page .sfm-session-view {
    padding: 10px 8px 18px;
}

.sfm-player-page .sfm-session-head {
    width: 100%;
    margin: 0 0 51px;
    text-align: center;
}

.sfm-player-page .sfm-session-head h2 {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 400;
    line-height: 1.25;
}

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

.sfm-player-page .sfm-progress-wrap {
    margin: 0 0 28px !important;
}

.sfm-player-page .sfm-progress-track {
    height: 6px !important;
}

.sfm-player-page .sfm-progress-fill {
    height: 6px !important;
    border-radius: 0 !important;
    background: #111 !important;
}

.sfm-player-page .sfm-progress-head {
    position: absolute;
    left: 0;
    top: 50%;
    z-index: 2;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #111;
    box-shadow: 0 1px 3px rgba(0,0,0,.18);
    transform: translate(-50%, -50%);
    transition: left .18s linear;
    pointer-events: none;
}

.sfm-player-page .sfm-alarm-marker {
    top: -2px !important;
    width: 2px !important;
    height: 10px !important;
    transform: translateX(-1px) !important;
}

.sfm-player-page .sfm-progress-labels {
    display: grid !important;
    grid-template-columns: minmax(54px, 1fr) auto minmax(54px, 1fr) !important;
    align-items: center !important;
    gap: 12px !important;
    margin-top: 10px !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    font-variant-numeric: tabular-nums;
}

.sfm-player-page .sfm-progress-labels .sfm-elapsed-time {
    justify-self: start;
}

.sfm-player-page .sfm-progress-labels .sfm-end-time {
    justify-self: end;
}

.sfm-inline-alarm {
    justify-self: center;
    white-space: nowrap;
}

.sfm-player-page .sfm-inline-controls {
    justify-content: center;
    margin: 0 0 42px;
}

.sfm-player-page .sfm-inline-btn {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: #3f3f3f;
}

.sfm-player-page .sfm-inline-btn:hover,
.sfm-player-page .sfm-inline-btn:active {
    background: transparent !important;
    color: #222;
}

.sfm-player-page .sfm-inline-btn:focus-visible {
    outline: 2px solid #3f3f3f;
    outline-offset: 3px;
}

.sfm-fa-control {
    font-size: 40px;
    line-height: 1;
}

.sfm-fa-control-pause,
.sfm-toggle.is-playing .sfm-fa-control-play {
    display: none;
}

.sfm-toggle.is-playing .sfm-fa-control-pause {
    display: inline-block;
}

.sfm-purpose-text {
    margin: 0 0 16px;
    color: #444;
    font-family: Roboto, "Noto Sans KR", sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.7;
    text-align: left;
    white-space: pre-line;
}

.sfm-player-page .sfm-reading-block {
    margin: 0 0 14px !important;
}

.sfm-player-page .sfm-reading-content {
    opacity: 0;
    transform: translateY(-10px);
    clip-path: inset(0 0 100% 0);
}

.sfm-player-page .sfm-reading-block.show-readings .sfm-reading-content {
    animation: sfmWipeReadings .8s ease forwards;
}

.sfm-player-page .sfm-reading-block .sfm-readings {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .sfm-player-page .sfm-reading-content {
        opacity: 1 !important;
        transform: none !important;
        clip-path: none !important;
        animation: none !important;
    }
}

@media (max-width: 480px) {
    .sfm-player-page .sfm-session-view {
        padding: 8px 2px 16px;
    }

    .sfm-player-page .sfm-session-head {
        margin-bottom: 45px;
    }

    .sfm-player-page .sfm-session-head h2 {
        font-size: 1.45rem;
    }

    .sfm-player-page .sfm-progress-labels {
        gap: 8px !important;
        font-size: 16px !important;
    }

    .sfm-inline-alarm {
        gap: 0;
    }
}


/* ===== v0.3.2 full-width player / remove outer pale border ===== */
.sfm-player-page {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
body:has(.sfm-player-page) .entry-content {
    width: 100% !important;
    max-width: none !important;
}
body:has(.sfm-player-page) .inside-article {
    border: 0 !important;
    box-shadow: none !important;
}
