/* Prayer shell (base.prayer.html.twig): scrolls; bead border zone uses gradient gutter masks. */
/* Insets: .prayer-shell padding + gutter outer edge; scale with --rosary-scale (PreferencesManager, default 1). */
:root {
    --rosary-scale: 1;
    --prayer-inner-radius: 24px;
    --prayer-inset-top: calc((clamp(3.75rem, 9vw, 6rem) * var(--rosary-scale, 1)) + 4px);
    --prayer-inset-inline: calc((clamp(1.25rem, 4vw, 2.75rem) * var(--rosary-scale, 1)) + 4px);
    --prayer-inset-bottom: calc((clamp(1.5rem, 5vw, 3rem) * var(--rosary-scale, 1)) + 4px);
    /* Extra gutter height beyond layout insets so vertical fade reaches full strength under beads. */
    --prayer-gutter-fade-v-extra: clamp(24px, 6vw, 56px);
    /* Small horizontal bleed for mistaken sideways scroll only. */
    --prayer-gutter-fade-h-extra: 12px;
}

.prayer-shell {
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    /* Extra horizontal inset keeps text inside the softened corner region. */
    padding: var(--prayer-inset-top) calc(var(--prayer-inset-inline) + var(--prayer-inner-radius))
        var(--prayer-inset-bottom);
}

.prayer-main {
    box-sizing: border-box;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.prayer-header-row {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    min-height: 3rem;
    margin-bottom: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.875rem;
}

.prayer-header-row__stem {
    flex: 1 1 auto;
    min-width: var(--prayer-stem-spacer-min, 10rem);
    min-height: 1px;
}

.prayer-header-row__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.prayer-header-row .site-header-auth {
    color: var(--color-text-muted);
}

.prayer-header-row .site-header-auth a {
    color: var(--color-gold);
}

/*
 * Gradient gutters: strong vertical fade into --color-bg near beads; weak horizontal (overflow only).
 * Stacking: prayer-shell (1) < gutter-mask (9) < rosary-border (10).
 */
.prayer-gutter-mask {
    position: fixed;
    inset: 0;
    z-index: 9;
    pointer-events: none;
    box-sizing: border-box;
}

.prayer-gutter-mask__edge {
    position: absolute;
    box-sizing: border-box;
}

/* Top: outer half saturated solid, inner half softens then transparent toward content. */
.prayer-gutter-mask__edge--top {
    left: 0;
    right: 0;
    top: 0;
    height: calc(var(--prayer-inset-top) + var(--prayer-gutter-fade-v-extra));
    background: linear-gradient(
        to bottom,
        var(--color-bg) 0%,
        var(--color-bg) 46%,
        rgba(var(--color-bg-rgb), 0.92) 62%,
        rgba(var(--color-bg-rgb), 0.45) 84%,
        rgba(var(--color-bg-rgb), 0) 100%
    );
}

.prayer-gutter-mask__edge--bottom {
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--prayer-inset-bottom) + var(--prayer-gutter-fade-v-extra));
    background: linear-gradient(
        to top,
        var(--color-bg) 0%,
        var(--color-bg) 46%,
        rgba(var(--color-bg-rgb), 0.92) 62%,
        rgba(var(--color-bg-rgb), 0.45) 84%,
        rgba(var(--color-bg-rgb), 0) 100%
    );
}

/* Side strips: thin, disappear quickly inland (mostly for accidental horizontal overflow). */
.prayer-gutter-mask__edge--left {
    left: 0;
    width: calc(var(--prayer-inset-inline) + var(--prayer-gutter-fade-h-extra));
    top: calc(var(--prayer-inset-top) + var(--prayer-gutter-fade-v-extra));
    bottom: calc(var(--prayer-inset-bottom) + var(--prayer-gutter-fade-v-extra));
    background: linear-gradient(
        to right,
        var(--color-bg) 0%,
        rgba(var(--color-bg-rgb), 0.35) 28%,
        rgba(var(--color-bg-rgb), 0) 100%
    );
}

.prayer-gutter-mask__edge--right {
    right: 0;
    width: calc(var(--prayer-inset-inline) + var(--prayer-gutter-fade-h-extra));
    top: calc(var(--prayer-inset-top) + var(--prayer-gutter-fade-v-extra));
    bottom: calc(var(--prayer-inset-bottom) + var(--prayer-gutter-fade-v-extra));
    background: linear-gradient(
        to left,
        var(--color-bg) 0%,
        rgba(var(--color-bg-rgb), 0.35) 28%,
        rgba(var(--color-bg-rgb), 0) 100%
    );
}

.prayer-footer {
    flex-shrink: 0;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.prayer-footer:empty {
    display: none;
}

.prayer-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    padding: 0.5rem 0 1rem;
    position: relative;
    box-sizing: border-box;
}

.prayer-content {
    max-width: 600px;
    width: 100%;
    text-align: center;
    z-index: 2;
    position: relative;
}

.prayer-countdown {
    font-size: 2.5em;
    font-family: var(--font-ui);
    color: var(--color-gold);
    margin-bottom: 1rem;
}

.prayer-countdown-label {
    font-size: 1em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.prayer-text {
    font-size: 1.25em;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    min-height: 3em;
}

.prayer-step-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.prayer-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}

.prayer-view-header {
    flex-shrink: 0;
    margin-bottom: 0.75rem;
}

.prayer-view-header .mystery-title,
.prayer-view-header .mystery-fruit {
    margin-bottom: 0.25rem;
}

.prayer-view-header .mystery-title:empty,
.prayer-view-header .mystery-fruit:empty {
    display: none;
}

.prayer-view-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mystery-art {
    flex-shrink: 0;
}

.prayer-view-text {
    flex: 1 1 auto;
    min-height: 0;
}

.mystery-title {
    font-size: 1.5em;
    color: var(--color-gold);
    margin-bottom: 0.75rem;
}

.mystery-image {
    max-width: 100%;
    max-height: 40vh;
    border-radius: 8px;
    margin-bottom: 0;
    object-fit: contain;
}

.mystery-artwork-credit {
    font-size: 0.75em;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.mystery-scripture {
    font-style: italic;
    font-size: 1em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.mystery-scripture-ref {
    font-size: 0.875em;
    color: var(--color-gold-dark);
    margin-bottom: 1rem;
}

.mystery-fruit {
    font-size: 0.875em;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.prayer-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

.prayer-view-footer .prayer-controls {
    position: static;
    transform: none;
}

.prayer-view-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-play-pause {
    background: none;
    border: 2px solid var(--color-gold-dark);
    color: var(--color-gold);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, color 0.2s;
    font-family: var(--font-ui);
}

.btn-play-pause:hover {
    border-color: var(--color-gold);
    color: var(--color-link-hover);
}

.prayer-progress {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

/* Start screen for Function 2 */
.prayer-start-screen {
    text-align: center;
}

.btn-start-prayer {
    display: inline-block;
    padding: 16px 32px;
    background: var(--color-gold-dark);
    color: var(--color-bg);
    font-family: var(--font-body);
    font-size: 1.25em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 1.5rem;
    transition: background-color 0.2s;
}

.btn-start-prayer:hover {
    background: var(--color-gold);
}

.mystery-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.btn-mystery {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--color-gold-dark);
    color: var(--color-text-muted);
    font-family: var(--font-ui);
    font-size: 0.875rem;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.btn-mystery:hover,
.btn-mystery--active {
    color: var(--color-gold);
    border-color: var(--color-gold);
}

.prayer-start-screen .today-mystery-line {
    margin-top: 1rem;
    margin-bottom: 0;
}


/* Joining overlay */
.joining-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 21, 16, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    font-size: 1.25em;
    color: var(--color-gold);
}

/* Resume prompt */
.resume-prompt {
    text-align: center;
}

.resume-prompt p {
    margin-bottom: 1rem;
    color: var(--color-text-muted);
}

.resume-prompt button {
    padding: 10px 24px;
    margin: 0 8px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 1em;
}

.btn-continue {
    background: var(--color-gold-dark);
    color: var(--color-bg);
}

.btn-start-over {
    background: transparent;
    border: 1px solid var(--color-gold-dark) !important;
    color: var(--color-text-muted);
}

@media (max-width: 480px) {
    .prayer-text {
        font-size: 1.1em;
    }

    .prayer-countdown {
        font-size: 2em;
    }

}