:root {
    color-scheme: dark;
    --night: #08111f;
    --night-soft: #101d30;
    --panel: rgba(17, 31, 50, 0.9);
    --panel-strong: #15243a;
    --line: rgba(226, 201, 145, 0.22);
    --gold: #e2c991;
    --gold-strong: #cda95d;
    --cream: #fff8e8;
    --muted: #aebbd0;
    --blue: #477ee8;
    --red: #d4515f;
    --focus: #9ec1ff;
    --history-radosne: #e6bd5b;
    --history-swiatla: #59c8d5;
    --history-bolesne: #e46672;
    --history-chwalebne: #9b82e8;
    --history-chaplet: #e2c991;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--night);
}

body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--cream);
    background:
        radial-gradient(circle at 12% 8%, rgba(56, 101, 166, 0.24), transparent 32rem),
        radial-gradient(circle at 88% 22%, rgba(156, 111, 55, 0.18), transparent 28rem),
        var(--night);
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
    touch-action: manipulation;
}

.rosary-shell {
    width: min(1180px, 100%);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding:
        max(16px, env(safe-area-inset-top))
        max(18px, env(safe-area-inset-right))
        max(28px, env(safe-area-inset-bottom))
        max(18px, env(safe-area-inset-left));
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 13px;
}

.brand-mark {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(226, 201, 145, 0.55);
    border-radius: 50%;
    color: var(--gold);
    background: linear-gradient(145deg, rgba(226, 201, 145, 0.13), rgba(71, 126, 232, 0.08));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    font-family: Georgia, serif;
    font-size: 1.65rem;
}

.brand-copy {
    min-width: 0;
}

.brand-kicker {
    margin: 0 0 2px;
    color: var(--gold);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.brand h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.55rem, 3vw, 2.35rem);
    font-weight: 600;
    line-height: 1;
}

.home-link,
.history-button,
.rosary-account-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--cream);
    text-decoration: none;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.04);
}

.history-button {
    gap: 8px;
    cursor: pointer;
}

.home-link:hover,
.history-button:hover,
.rosary-account-link:hover {
    border-color: var(--gold-strong);
    color: var(--gold);
}

.rosary-account-link {
    min-height: 36px;
    padding: 7px 11px;
}

.calendar-glyph {
    position: relative;
    display: inline-block;
    width: 17px;
    height: 15px;
    flex: 0 0 auto;
    border: 1.5px solid currentColor;
    border-radius: 3px;
}

.calendar-glyph::before {
    position: absolute;
    top: -4px;
    left: 3px;
    width: 2px;
    height: 6px;
    border-radius: 2px;
    background: currentColor;
    box-shadow: 7px 0 0 currentColor;
    content: "";
}

.calendar-glyph::after {
    position: absolute;
    top: 4px;
    right: 2px;
    left: 2px;
    height: 1px;
    background: currentColor;
    box-shadow: 0 3px 0 rgba(255, 255, 255, 0.35), 0 6px 0 rgba(255, 255, 255, 0.35);
    content: "";
}

.prayer-card {
    display: grid;
    grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
    gap: 18px;
    align-items: stretch;
}

.control-panel,
.rosary-stage,
.intentions {
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px);
}

.control-panel {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 22px;
}

.section-label {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 750;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.mystery-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.mystery-type,
.reset-button,
.mystery-button,
.slider-button {
    min-height: 48px;
    border: 1px solid rgba(226, 201, 145, 0.28);
    border-radius: 14px;
    color: var(--cream);
    background: rgba(255, 255, 255, 0.045);
    cursor: pointer;
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        background-color 160ms ease,
        color 160ms ease;
}

.mystery-type {
    padding: 10px 9px;
    text-align: left;
}

.mystery-type span {
    display: block;
    font-weight: 750;
}

.mystery-type small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.68rem;
}

.mystery-type:hover,
.reset-button:hover,
.mystery-button:hover,
.slider-button:hover {
    border-color: var(--gold-strong);
    transform: translateY(-1px);
}

.mystery-type.is-active,
.mystery-button.is-active {
    border-color: #77a2ff;
    color: #fff;
    background: rgba(71, 126, 232, 0.3);
    box-shadow: inset 0 0 0 1px rgba(119, 162, 255, 0.28);
}

.mystery-type.is-complete,
.mystery-button.is-complete {
    border-color: rgba(236, 112, 125, 0.75);
    background: rgba(212, 81, 95, 0.2);
}

.chaplet-type {
    grid-column: 1 / -1;
}

.chaplet-type.is-active {
    border-color: var(--gold-strong);
    background: rgba(205, 169, 93, 0.23);
    box-shadow: inset 0 0 0 1px rgba(226, 201, 145, 0.28);
}

.reset-button {
    grid-column: 1 / -1;
    padding: 10px 14px;
    color: var(--gold);
}

.mystery-list-wrap {
    min-width: 0;
    margin-top: 22px;
}

.mystery-list {
    display: grid;
    gap: 8px;
}

.mystery-list-empty {
    margin: 0;
    padding: 18px;
    border: 1px dashed rgba(174, 187, 208, 0.28);
    border-radius: 14px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.chaplet-prayer-guide {
    display: grid;
    gap: 8px;
}

.chaplet-prayer-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 10px 12px;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(226, 201, 145, 0.2);
    border-radius: 12px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.035);
    font-size: 0.78rem;
    line-height: 1.35;
}

.chaplet-prayer-item strong {
    display: block;
    color: var(--cream);
    font-size: 0.84rem;
}

.chaplet-bead-marker {
    display: block;
    width: 18px;
    height: 18px;
    margin: auto;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    background: #477ee8;
    box-shadow: 0 0 9px rgba(71, 126, 232, 0.55);
}

.chaplet-bead-marker.is-large {
    width: 24px;
    height: 24px;
    background: #cda95d;
    box-shadow: 0 0 9px rgba(226, 201, 145, 0.55);
}

.chaplet-bead-marker.is-ending {
    border-radius: 7px;
    background: linear-gradient(135deg, #477ee8 0 50%, #cda95d 50% 100%);
}

.mystery-button {
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    line-height: 1.25;
}

.mystery-select-button {
    width: 100%;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.mystery-references {
    display: flex;
    flex-wrap: wrap;
    margin-top: 7px;
    gap: 5px 10px;
}

.mystery-references a {
    color: var(--gold);
    font-size: 0.76rem;
    font-weight: 650;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.mystery-references a:hover {
    color: var(--cream);
}

.rosary-stage {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.current-prayer-context {
    width: min(100%, 440px);
    min-height: 92px;
    margin-bottom: 12px;
    padding: 13px 16px;
    border: 1px solid rgba(226, 201, 145, 0.3);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(226, 201, 145, 0.11), rgba(71, 126, 232, 0.1));
    text-align: center;
}

.current-prayer-eyebrow {
    margin: 0 0 4px;
    color: var(--gold);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.current-prayer-context strong {
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.25;
}

.current-prayer-name {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.current-prayer-name[hidden] {
    display: none;
}

.rosary-board {
    position: relative;
    display: block;
    width: min(100%, 440px);
    max-width: 100%;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 24px;
    color: inherit;
    background:
        radial-gradient(circle at 50% 42%, rgba(71, 126, 232, 0.09), transparent 52%),
        rgba(5, 12, 23, 0.48);
    cursor: pointer;
}

.rosary-board:focus-visible,
.mystery-type:focus-visible,
.reset-button:focus-visible,
.mystery-select-button:focus-visible,
.mystery-references a:focus-visible,
.slider-button:focus-visible,
.home-link:focus-visible,
.history-button:focus-visible,
.history-close-button:focus-visible,
.history-nav-button:focus-visible,
.history-today-button:focus-visible,
.history-day:focus-visible,
.history-save-button:focus-visible,
.history-clear-button:focus-visible,
.history-decade-button:focus-visible,
.history-type-clear-button:focus-visible,
.history-novena-input-row input:focus-visible,
.history-chaplet-input-row input:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.rosary-board svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 68vh;
    max-height: 68dvh;
}

.rosary-board circle,
.rosary-board path {
    transition: fill 180ms ease, filter 180ms ease;
}

.rosary-board .is-current-step {
    stroke: #ffffff;
    stroke-width: 6;
    filter: drop-shadow(0 0 10px rgba(119, 162, 255, 0.95));
}

.rosary-board.is-chaplet-mode .is-current-step {
    filter: drop-shadow(0 0 10px rgba(226, 201, 145, 0.95));
}

.tap-hint {
    display: block;
    margin: 8px 12px 12px;
    padding: 8px 12px;
    border: 1px solid rgba(226, 201, 145, 0.2);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(8, 17, 31, 0.82);
    font-size: 0.75rem;
    text-align: center;
    pointer-events: none;
}

.history-dialog {
    width: min(1060px, calc(100% - 24px));
    max-width: none;
    max-height: calc(100dvh - 24px);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(226, 201, 145, 0.38);
    border-radius: 24px;
    color: var(--cream);
    background: #0d192a;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.62);
}

.history-dialog::backdrop {
    background: rgba(2, 7, 14, 0.78);
    backdrop-filter: blur(5px);
}

.history-dialog-surface {
    max-height: calc(100dvh - 26px);
    padding: 24px;
    overflow: auto;
    background:
        radial-gradient(circle at 10% 4%, rgba(71, 126, 232, 0.17), transparent 26rem),
        radial-gradient(circle at 92% 18%, rgba(205, 169, 93, 0.12), transparent 22rem),
        #0d192a;
}

.history-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.history-dialog-header .section-label {
    margin-bottom: 4px;
    color: var(--gold);
}

.history-dialog-header h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 600;
}

.history-close-button {
    display: grid;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0 0 3px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--cream);
    background: rgba(255, 255, 255, 0.05);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.history-legend {
    display: flex;
    flex-wrap: wrap;
    margin-top: 18px;
    gap: 8px 18px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.history-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.history-legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 9px currentColor;
}

.history-chaplet-legend {
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    color: var(--history-chaplet);
    font-size: 0.61rem;
    font-style: normal;
    font-weight: 900;
    box-shadow: 0 0 8px rgba(226, 201, 145, 0.35);
}

.history-color-0 {
    color: var(--history-radosne);
}

.history-color-1 {
    color: var(--history-swiatla);
}

.history-color-2 {
    color: var(--history-bolesne);
}

.history-color-3 {
    color: var(--history-chwalebne);
}

.history-explanation {
    margin: 8px 0 20px;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.daily-mystery-hint {
    margin: 0;
    padding: 12px 15px;
    border-left: 3px solid var(--gold);
    border-radius: 0 10px 10px 0;
    color: var(--cream);
    background: rgba(226, 201, 145, 0.08);
    font-size: 0.82rem;
    line-height: 1.45;
}

.history-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 310px);
    gap: 20px;
    align-items: start;
}

.history-calendar-panel {
    min-width: 0;
}

.history-calendar-toolbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px auto;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}

.history-calendar-toolbar h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    font-weight: 600;
    text-align: center;
}

.history-nav-button,
.history-today-button,
.history-save-button,
.history-clear-button {
    min-height: 44px;
    border: 1px solid rgba(226, 201, 145, 0.28);
    border-radius: 12px;
    color: var(--cream);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.history-nav-button {
    font-size: 1.35rem;
}

.history-today-button {
    padding: 0 13px;
    color: var(--gold);
}

.history-weekdays,
.history-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.history-weekdays {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.history-day,
.history-calendar-empty {
    min-width: 0;
    min-height: 96px;
    border-radius: 12px;
}

.history-calendar-empty {
    border: 1px dashed rgba(174, 187, 208, 0.08);
}

.history-day {
    display: flex;
    padding: 5px;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid rgba(174, 187, 208, 0.16);
    color: var(--cream);
    background: rgba(255, 255, 255, 0.025);
    cursor: pointer;
}

.history-day:hover {
    border-color: rgba(226, 201, 145, 0.55);
    background: rgba(255, 255, 255, 0.055);
}

.history-day-header {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 3px;
}

.history-day-badges {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
}

.history-day.is-selected {
    border-color: #77a2ff;
    background: rgba(71, 126, 232, 0.16);
    box-shadow: inset 0 0 0 1px rgba(119, 162, 255, 0.24);
}

.history-day-number {
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 800;
}

.history-day.is-today .history-day-number {
    color: #172033;
    background: var(--gold);
}

.history-novena-day {
    max-width: 100%;
    padding: 3px 6px;
    overflow: hidden;
    border: 1px solid rgba(226, 201, 145, 0.48);
    border-radius: 999px;
    color: var(--gold);
    background: rgba(226, 201, 145, 0.1);
    font-size: 0.58rem;
    font-weight: 850;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-chaplet-count {
    max-width: 100%;
    padding: 3px 6px;
    overflow: hidden;
    border: 1px solid rgba(226, 201, 145, 0.48);
    border-radius: 999px;
    color: var(--history-chaplet);
    background: rgba(226, 201, 145, 0.1);
    font-size: 0.58rem;
    font-weight: 850;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-day-rings {
    display: grid;
    grid-template-columns: repeat(2, 27px);
    margin: auto;
    gap: 3px;
}

.history-ring {
    --ring-color: var(--history-radosne);
    --ring-segment-1: rgba(174, 187, 208, 0.16);
    --ring-segment-2: rgba(174, 187, 208, 0.16);
    --ring-segment-3: rgba(174, 187, 208, 0.16);
    --ring-segment-4: rgba(174, 187, 208, 0.16);
    --ring-segment-5: rgba(174, 187, 208, 0.16);
    position: relative;
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border-radius: 50%;
    color: var(--cream);
    background: conic-gradient(
        from 0deg,
        var(--ring-segment-1) 0deg 69deg,
        transparent 69deg 72deg,
        var(--ring-segment-2) 72deg 141deg,
        transparent 141deg 144deg,
        var(--ring-segment-3) 144deg 213deg,
        transparent 213deg 216deg,
        var(--ring-segment-4) 216deg 285deg,
        transparent 285deg 288deg,
        var(--ring-segment-5) 288deg 357deg,
        transparent 357deg 360deg
    );
    font-size: 0.56rem;
    font-weight: 850;
    line-height: 1;
    box-shadow: 0 0 7px color-mix(in srgb, var(--ring-color) 20%, transparent);
}

.history-ring::before {
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #15243a;
    content: "";
}

.history-ring > span {
    position: relative;
    z-index: 1;
}

.history-ring-0 {
    --ring-color: var(--history-radosne);
}

.history-ring-1 {
    --ring-color: var(--history-swiatla);
}

.history-ring-2 {
    --ring-color: var(--history-bolesne);
}

.history-ring-3 {
    --ring-color: var(--history-chwalebne);
}

.history-editor {
    padding: 18px;
    border: 1px solid rgba(226, 201, 145, 0.2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.035);
}

.history-editor .section-label {
    margin-bottom: 5px;
}

.history-editor h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.18rem;
    font-weight: 600;
}

.history-editor-help {
    margin: 7px 0 16px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.history-novena-input-row,
.history-chaplet-input-row {
    display: flex;
    margin-bottom: 13px;
    padding-bottom: 13px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(226, 201, 145, 0.14);
    color: var(--cream);
    font-size: 0.86rem;
    font-weight: 750;
}

.history-novena-input-row > span,
.history-chaplet-input-row > span {
    display: grid;
    gap: 3px;
}

.history-novena-input-row small,
.history-chaplet-input-row small {
    color: var(--muted);
    font-size: 0.67rem;
    font-weight: 500;
}

.history-inputs {
    display: grid;
    gap: 13px;
}

.history-input-group {
    --history-input-color: var(--history-radosne);
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    color: var(--cream);
    font-size: 0.86rem;
    font-weight: 700;
}

.history-input-group-1 {
    --history-input-color: var(--history-swiatla);
}

.history-input-group-2 {
    --history-input-color: var(--history-bolesne);
}

.history-input-group-3 {
    --history-input-color: var(--history-chwalebne);
}

.history-input-group legend {
    display: inline-flex;
    margin-bottom: 7px;
    padding: 0;
    align-items: center;
    gap: 7px;
}

.history-decade-inputs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
}

.history-decade-button {
    min-width: 0;
    min-height: 44px;
    padding: 6px 4px;
    border: 1px solid rgba(226, 201, 145, 0.3);
    border-radius: 10px;
    color: var(--muted);
    background: rgba(8, 17, 31, 0.8);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 850;
    text-align: center;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.history-decade-button:hover {
    color: var(--cream);
    border-color: color-mix(in srgb, var(--history-input-color) 70%, white);
}

.history-decade-button.is-selected {
    border-color: var(--history-input-color);
    color: #ffffff;
    background: color-mix(in srgb, var(--history-input-color) 30%, rgba(8, 17, 31, 0.8));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--history-input-color) 45%, transparent);
}

.history-type-clear-button {
    width: 100%;
    min-height: 34px;
    margin-top: 7px;
    padding: 6px 10px;
    border: 1px solid rgba(174, 187, 208, 0.22);
    border-radius: 9px;
    color: var(--muted);
    background: rgba(8, 17, 31, 0.48);
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
}

.history-type-clear-button:not(:disabled):hover {
    border-color: var(--history-input-color);
    color: var(--cream);
}

.history-type-clear-button:disabled {
    opacity: 0.52;
    cursor: default;
}

.history-type-clear-button span {
    color: var(--history-input-color);
    font-weight: 900;
}

.history-novena-input-row input,
.history-chaplet-input-row input {
    width: 90px;
    min-height: 42px;
    padding-inline: 9px;
    border: 1px solid rgba(226, 201, 145, 0.3);
    border-radius: 10px;
    color: var(--cream);
    background: rgba(8, 17, 31, 0.8);
    font: inherit;
    text-align: right;
}

.history-editor-actions {
    display: grid;
    margin-top: 16px;
    gap: 8px;
}

.history-save-button {
    border-color: rgba(119, 162, 255, 0.68);
    background: rgba(71, 126, 232, 0.28);
    font-weight: 800;
}

.history-clear-button {
    color: var(--muted);
}

.history-save-status {
    min-height: 1.3em;
    margin: 10px 0 0;
    color: #8fd2aa;
    font-size: 0.74rem;
    line-height: 1.4;
}

.history-save-status.is-error {
    color: #ff9ca7;
}

.intentions {
    margin-top: 18px;
    padding: 22px;
}

.intentions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.intentions-header h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.3rem, 2vw, 1.7rem);
    font-weight: 600;
}

.slider-controls {
    display: flex;
    gap: 8px;
}

.slider-button {
    width: 46px;
    min-height: 46px;
    font-size: 1.35rem;
}

.intention-card {
    min-height: 152px;
    padding: 20px;
    border: 1px solid rgba(226, 201, 145, 0.16);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.035);
}

.intention-card[hidden] {
    display: none;
}

.intention-month {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.intention-card h3 {
    margin: 0 0 8px;
    font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.intention-card p:last-child {
    max-width: 72ch;
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

@media (min-width: 768px) {
    .history-dialog {
        width: 100vw;
        height: 100dvh;
        max-height: none;
        margin: 0;
        border: 0;
        border-radius: 0;
    }

    .history-dialog-surface {
        height: 100%;
        max-height: none;
        padding: clamp(24px, 3vw, 48px);
    }

    .history-content {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
        gap: clamp(24px, 3vw, 48px);
    }
}

@media (max-width: 767px) {
    .rosary-shell {
        padding:
            max(10px, env(safe-area-inset-top))
            max(10px, env(safe-area-inset-right))
            max(20px, env(safe-area-inset-bottom))
            max(10px, env(safe-area-inset-left));
    }

    .app-header {
        align-items: flex-start;
        margin-bottom: 10px;
    }

    .brand {
        gap: 9px;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
        font-size: 1.35rem;
    }

    .brand-kicker {
        display: none;
    }

    .home-link {
        width: 44px;
        min-width: 44px;
        padding: 8px;
        font-size: 0;
    }

    .home-link::before {
        content: "←";
        font-size: 1.15rem;
    }

    .header-actions {
        gap: 6px;
    }

    .history-button {
        width: 44px;
        min-width: 44px;
        padding: 8px;
    }

    .history-button > span:last-child {
        display: none;
    }

    .history-dialog {
        width: calc(100% - 12px);
        max-height: calc(100dvh - 12px);
        border-radius: 18px;
    }

    .history-dialog-surface {
        max-height: calc(100dvh - 14px);
        padding: 14px;
    }

    .history-legend {
        margin-top: 13px;
        gap: 6px 12px;
    }

    .history-explanation {
        margin-bottom: 15px;
    }

    .history-content {
        display: block;
    }

    .history-calendar-toolbar {
        grid-template-columns: 40px minmax(0, 1fr) 40px;
    }

    .history-today-button {
        grid-column: 1 / -1;
        min-height: 38px;
    }

    .history-weekdays,
    .history-calendar {
        gap: 3px;
    }

    .history-day,
    .history-calendar-empty {
        min-height: 67px;
        border-radius: 8px;
    }

    .history-day {
        padding: 3px;
    }

    .history-day-number {
        width: 20px;
        height: 20px;
        font-size: 0.66rem;
    }

    .history-novena-day {
        padding: 2px 3px;
        border-color: rgba(226, 201, 145, 0.4);
        font-size: 0.49rem;
    }

    .history-day-badges {
        align-items: flex-end;
        flex-direction: column;
        gap: 2px;
    }

    .history-chaplet-count {
        padding: 2px 3px;
        font-size: 0.49rem;
    }

    .history-day-rings {
        grid-template-columns: repeat(2, clamp(15px, 5vw, 21px));
        gap: 2px;
    }

    .history-ring {
        width: clamp(15px, 5vw, 21px);
        height: clamp(15px, 5vw, 21px);
        font-size: 0.46rem;
    }

    .history-ring::before {
        inset: 3px;
    }

    .history-editor {
        margin-top: 16px;
        padding: 15px;
    }

    .prayer-card {
        display: block;
    }

    .control-panel,
    .rosary-stage,
    .intentions {
        border-radius: 18px;
    }

    .control-panel {
        padding: 14px;
    }

    .mystery-type-grid {
        gap: 7px;
    }

    .mystery-type {
        min-height: 54px;
        padding: 8px 10px;
    }

    .mystery-list-wrap {
        margin-top: 14px;
    }

    .mystery-list {
        display: flex;
        margin: 0 -14px;
        padding: 0 14px 8px;
        gap: 8px;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
    }

    .mystery-list > * {
        flex: 0 0 min(82vw, 330px);
        scroll-snap-align: start;
    }

    .mystery-list-empty {
        flex-basis: calc(100vw - 48px);
        padding: 13px;
    }

    .mystery-button {
        min-height: 58px;
    }

    .rosary-stage {
        margin-top: 10px;
        padding: 8px 10px 14px;
    }

    .current-prayer-context {
        position: sticky;
        top: max(8px, env(safe-area-inset-top));
        z-index: 5;
        min-height: 84px;
        margin-bottom: 8px;
        padding: 10px 12px;
        border-color: rgba(226, 201, 145, 0.5);
        background: rgba(16, 29, 48, 0.96);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
        backdrop-filter: blur(16px);
    }

    .current-prayer-context strong {
        font-size: 1rem;
    }

    .rosary-board {
        width: min(100%, 390px);
        border-radius: 18px;
    }

    .rosary-board svg {
        max-height: none;
    }

    .tap-hint {
        margin: 6px 8px 8px;
        font-size: 0.69rem;
    }

    .intentions {
        margin-top: 10px;
        padding: 16px;
    }

    .intention-card {
        min-height: 210px;
        padding: 16px;
    }
}

@media (max-width: 390px) {
    .mystery-type small {
        display: none;
    }

    .section-label {
        margin-bottom: 9px;
    }
}

@media (max-height: 560px) and (orientation: landscape) {
    .rosary-shell {
        padding-top: 8px;
    }

    .app-header {
        margin-bottom: 8px;
    }

    .brand-mark,
    .brand-kicker {
        display: none;
    }

    .prayer-card {
        display: grid;
        grid-template-columns: minmax(300px, 1fr) minmax(250px, 0.8fr);
        gap: 8px;
    }

    .control-panel {
        padding: 10px;
    }

    .mystery-list-wrap {
        margin-top: 8px;
    }

    .mystery-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .mystery-list > * {
        min-width: 0;
    }

    .mystery-button {
        min-height: 42px;
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .rosary-stage {
        margin-top: 0;
        padding: 6px;
    }

    .current-prayer-context {
        position: static;
        min-height: 52px;
        margin-bottom: 4px;
        padding: 5px 8px;
    }

    .current-prayer-eyebrow {
        margin-bottom: 1px;
        font-size: 0.58rem;
    }

    .current-prayer-context strong {
        font-size: 0.78rem;
    }

    .current-prayer-name {
        margin-top: 1px;
        font-size: 0.65rem;
    }

    .rosary-board {
        width: auto;
        height: calc(100dvh - 164px);
    }

    .rosary-board svg {
        width: auto;
        height: 100%;
    }

    .tap-hint {
        display: none;
    }

}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
