/* Loaded after style.css: compact theme control and responsive reading scale. */
.site-header .header-actions {
    gap: 0.42rem !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

/* Tarot interaction: stable card geometry, one render pass, and a quieter chat flow. */
.tarot-table {
    overflow: hidden !important;
    background:
        radial-gradient(circle at 50% 86%, rgba(122, 142, 178, calc(0.12 - var(--theme-progress) * 0.05)), transparent 44%),
        var(--qa-surface) !important;
}

.tarot-spread-zone {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
    width: min(100%, 44rem) !important;
    min-height: 74px !important;
    margin: 0.8rem auto 0 !important;
}

.tarot-spread-zone:has(.spread-slot:only-child) {
    grid-template-columns: minmax(0, 13rem) !important;
    justify-content: center !important;
}

.spread-slot {
    min-width: 0 !important;
    min-height: 70px !important;
    padding: 0.7rem 0.8rem !important;
    border: 1px solid var(--qa-line) !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, calc(0.46 - var(--theme-progress) * 0.39)) !important;
    box-shadow: none !important;
}

.spread-slot strong,
.spread-slot span {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.spread-slot strong {
    font-size: 0.92rem !important;
    line-height: 1.3 !important;
}

.spread-slot > span:last-child {
    color: var(--qa-muted) !important;
    font-size: 0.76rem !important;
}

.tarot-deck-fan {
    position: relative !important;
    display: block !important;
    width: min(100%, 38rem) !important;
    height: clamp(280px, 34vw, 360px) !important;
    min-height: 280px !important;
    margin: 0.25rem auto 0 !important;
    overflow: visible !important;
    isolation: isolate !important;
    perspective: 1100px !important;
    contain: layout !important;
}

.tarot-deck-fan .deck-card {
    position: absolute !important;
    inset: auto auto 1.6rem 50% !important;
    width: clamp(92px, 8vw, 116px) !important;
    height: clamp(156px, 13.56vw, 197px) !important;
    aspect-ratio: 0.59 !important;
    margin: 0 !important;
    padding: 0 !important;
    contain: none !important;
    opacity: 1 !important;
    transform: translate3d(-50%, 52px, 0) rotate(0deg) !important;
    transform-origin: 50% 112% !important;
    transition:
        transform 620ms cubic-bezier(0.22, 0.78, 0.2, 1),
        opacity 260ms ease,
        filter 260ms ease !important;
    transition-delay: calc(var(--fan-index) * 14ms) !important;
    will-change: transform, opacity !important;
    touch-action: manipulation !important;
}

.tarot-deck-fan .deck-card:disabled {
    cursor: default !important;
    opacity: 1 !important;
}

.tarot-deck-fan.is-shuffling .deck-card,
.tarot-deck-fan.is-ready .deck-card,
.tarot-deck-fan.is-selected .deck-card {
    transform: translate3d(calc(-50% + var(--card-shift)), 0, 0) rotate(var(--card-rotate)) !important;
}

.tarot-deck-fan.is-ready .deck-card {
    cursor: pointer !important;
}

.tarot-deck-fan.is-ready .deck-card.is-selected,
.tarot-deck-fan.is-selected .deck-card.is-selected {
    z-index: calc(40 + var(--selected-order)) !important;
    filter: brightness(1.08) drop-shadow(0 18px 18px rgba(39, 49, 72, 0.23)) !important;
    transform: translate3d(calc(-50% + var(--card-shift)), -28px, 0) rotate(var(--card-rotate)) !important;
}

.tarot-deck-fan.is-drawing .deck-card:not(.is-selected) {
    opacity: 0.12 !important;
    filter: blur(1px) !important;
    transform: translate3d(calc(-50% + var(--card-shift)), 22px, 0) rotate(var(--card-rotate)) scale(0.96) !important;
}

.tarot-deck-fan.is-drawing .deck-card.is-selected {
    z-index: calc(40 + var(--selected-order)) !important;
    transform: translate3d(calc(-50% + var(--card-shift)), -42px, 0) rotate(var(--card-rotate)) scale(1.03) !important;
}

@media (hover: hover) and (pointer: fine) {
    .tarot-deck-fan.is-ready .deck-card:not(.is-selected):hover {
        z-index: 32 !important;
        transform: translate3d(calc(-50% + var(--card-shift)), -16px, 0) rotate(var(--card-rotate)) !important;
    }
}

.ai-chat-panel {
    width: min(100%, 52rem) !important;
    margin: 2.25rem auto 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid var(--qa-line) !important;
    border-radius: 20px !important;
    background: var(--qa-surface) !important;
    box-shadow: 0 18px 48px rgba(24, 34, 52, calc(0.08 + var(--theme-progress) * 0.08)) !important;
}

.ai-chat-head {
    display: grid !important;
    gap: 0.22rem !important;
    padding: 1.1rem 1.2rem 0.95rem !important;
    border-bottom: 1px solid var(--qa-line) !important;
}

.ai-chat-head strong {
    color: var(--qa-ink) !important;
    font-size: 1rem !important;
    line-height: 1.35 !important;
}

.ai-chat-head p,
.ai-chat-empty,
.ai-chat-remaining {
    margin: 0 !important;
    color: var(--qa-muted) !important;
    font-size: 0.82rem !important;
    line-height: 1.5 !important;
}

.ai-chat-log {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.72rem !important;
    max-height: 26rem !important;
    padding: 1rem 1.2rem !important;
    overflow: auto !important;
    overscroll-behavior: contain !important;
    scrollbar-width: thin !important;
}

.ai-chat-empty {
    padding: 1rem 1.2rem 0 !important;
}

.ai-chat-bubble {
    width: fit-content !important;
    max-width: min(86%, 38rem) !important;
    margin: 0 !important;
    padding: 0.72rem 0.9rem !important;
    border: 0 !important;
    border-radius: 16px !important;
    box-shadow: none !important;
}

.ai-chat-bubble.is-user {
    align-self: flex-end !important;
    border-bottom-right-radius: 6px !important;
    color: rgba(255, 255, 255, 0.96) !important;
    background: rgb(calc(57 - var(--theme-progress) * 24), calc(72 - var(--theme-progress) * 35), calc(98 - var(--theme-progress) * 46)) !important;
}

.ai-chat-bubble.is-assistant {
    align-self: flex-start !important;
    border: 1px solid var(--qa-line) !important;
    border-bottom-left-radius: 6px !important;
    color: var(--qa-ink) !important;
    background: rgba(255, 255, 255, calc(0.54 - var(--theme-progress) * 0.46)) !important;
}

.ai-chat-content,
.ai-chat-content p {
    margin: 0 !important;
    color: inherit !important;
    font-size: 0.94rem !important;
    line-height: 1.68 !important;
}

.ai-chat-compose {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: end !important;
    gap: 0.6rem !important;
    margin: 1rem 1.2rem 0 !important;
    padding: 0.45rem !important;
    border: 1px solid var(--qa-line) !important;
    border-radius: 17px !important;
    background: rgba(255, 255, 255, calc(0.62 - var(--theme-progress) * 0.54)) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, calc(0.7 - var(--theme-progress) * 0.56)) !important;
}

.ai-chat-compose textarea {
    width: 100% !important;
    min-height: 42px !important;
    max-height: 132px !important;
    padding: 0.62rem 0.68rem !important;
    resize: none !important;
    overflow-y: auto !important;
    border: 0 !important;
    border-radius: 12px !important;
    outline: 0 !important;
    color: var(--qa-ink) !important;
    background: transparent !important;
    box-shadow: none !important;
    font: inherit !important;
    font-size: 0.94rem !important;
    line-height: 1.5 !important;
}

.ai-chat-send {
    min-width: 4.5rem !important;
    min-height: 42px !important;
    padding: 0 0.9rem !important;
    border-radius: 13px !important;
    white-space: nowrap !important;
}

.ai-chat-remaining {
    padding: 0.6rem 1.2rem 1rem !important;
    text-align: right !important;
}

@media (max-width: 760px) {
    .tarot-table {
        min-height: 0 !important;
        padding: 0.9rem 0.7rem 0.25rem !important;
    }

    .tarot-table-head {
        gap: 0.55rem !important;
        padding: 0 0.18rem !important;
    }

    .tarot-table-head > div { min-width: 0 !important; }

    .tarot-selection-copy {
        max-width: 45% !important;
        text-align: right !important;
    }

    .tarot-spread-zone {
        gap: 0.4rem !important;
        min-height: 66px !important;
        margin-top: 0.65rem !important;
    }

    .spread-slot {
        min-height: 62px !important;
        padding: 0.55rem 0.48rem !important;
        border-radius: 12px !important;
    }

    .spread-slot .section-kicker { font-size: 0.65rem !important; }
    .spread-slot strong { font-size: 0.78rem !important; }
    .spread-slot > span:last-child { font-size: 0.68rem !important; }

    .tarot-deck-fan {
        width: 100% !important;
        height: 304px !important;
        min-height: 304px !important;
        margin-top: 0 !important;
        contain: layout !important;
    }

    .tarot-deck-fan .deck-card {
        inset: auto auto 1.2rem 50% !important;
        width: clamp(82px, 23.5vw, 92px) !important;
        height: clamp(139px, 39.8vw, 156px) !important;
        contain: none !important;
        transition-duration: 540ms, 220ms, 220ms !important;
        transition-delay: calc(var(--fan-index) * 11ms) !important;
    }

    .tarot-deck-fan.is-ready .deck-card.is-selected,
    .tarot-deck-fan.is-selected .deck-card.is-selected {
        transform: translate3d(calc(-50% + var(--card-shift)), -24px, 0) rotate(var(--card-rotate)) !important;
    }

    .tarot-deck-fan.is-drawing .deck-card.is-selected {
        transform: translate3d(calc(-50% + var(--card-shift)), -34px, 0) rotate(var(--card-rotate)) !important;
    }

    .ai-chat-panel {
        margin-top: 1.5rem !important;
        border-radius: 18px !important;
    }

    .ai-chat-head {
        padding: 0.95rem 1rem 0.8rem !important;
    }

    .ai-chat-log {
        max-height: 22rem !important;
        gap: 0.62rem !important;
        padding: 0.85rem 1rem !important;
    }

    .ai-chat-empty { padding: 0.85rem 1rem 0 !important; }

    .ai-chat-bubble {
        max-width: 90% !important;
        padding: 0.68rem 0.8rem !important;
        border-radius: 15px !important;
    }

    .ai-chat-compose {
        margin: 0.85rem 0.8rem 0 !important;
        gap: 0.35rem !important;
    }

    .ai-chat-send {
        min-width: 3.9rem !important;
        padding: 0 0.72rem !important;
        font-size: 0.82rem !important;
    }

    .ai-chat-remaining { padding: 0.52rem 0.95rem 0.85rem !important; }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-deck-fan .deck-card {
        transition-duration: 1ms !important;
        transition-delay: 0ms !important;
    }
}

/* Editorial provenance and the daily home-screen line. */
.home-daily-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.38rem 0.7rem;
    max-width: min(42rem, 88vw);
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;
    transform: translate3d(0, 7px, 0);
    transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1), transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.home-daily-line.is-ready {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.home-daily-line.is-changing {
    opacity: 0;
    transform: translate3d(0, 4px, 0);
}

.home-daily-line > span {
    font-size: clamp(0.9rem, 1.2vw, 1.02rem);
    line-height: 1.55;
    text-wrap: balance;
}

.home-daily-line > small {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.72rem;
    line-height: 1.4;
    white-space: nowrap;
}

.content-origin-note {
    display: inline-flex;
    align-items: center;
    color: var(--qa-muted, var(--muted)) !important;
    font-size: 0.68rem;
    font-weight: 560;
    line-height: 1.35;
    opacity: 0.72;
    white-space: nowrap;
}

.home-story-meta {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: 0.55rem 0.8rem !important;
}

.home-story-meta .content-origin-note {
    margin-left: auto;
}

.note-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
}

.article-sources {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.45rem 0.9rem;
    margin-top: clamp(2.4rem, 5vw, 4rem);
    padding-top: 0.25rem;
    color: var(--qa-muted, var(--muted));
    font-size: 0.78rem;
    line-height: 1.6;
}

.article-sources > span {
    font-weight: 650;
}

.article-sources a {
    color: inherit !important;
    text-decoration-color: color-mix(in srgb, currentColor 34%, transparent);
}

.article-sources a:hover {
    color: var(--qa-ink, var(--text)) !important;
}

@media (max-width: 760px) {
    .home-daily-line {
        display: grid;
        gap: 0.25rem;
        max-width: min(21rem, 86vw);
        margin-top: 0.85rem;
    }

    .home-daily-line > span {
        font-size: 0.86rem;
    }

    .home-daily-line > small {
        font-size: 0.68rem;
    }

    .content-origin-note {
        font-size: 0.64rem;
    }

    .article-sources {
        display: grid;
        gap: 0.35rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-daily-line,
    .home-daily-line.is-ready,
    .home-daily-line.is-changing {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Recent draws: a quiet archive list, not another stack of glass cards. */
.tarot-history {
    position: relative;
    display: grid;
    gap: 0;
    margin-top: clamp(2.4rem, 6vw, 4.5rem) !important;
    padding: clamp(1rem, 2.5vw, 1.45rem) 0 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-top: 1px solid var(--qa-line) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    filter: none !important;
}

.tarot-history::before,
.tarot-history::after,
.tarot-history-item::before,
.tarot-history-item::after {
    display: none !important;
    content: none !important;
}

.tarot-history-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1rem !important;
    padding: 0 0 clamp(0.75rem, 2vw, 1rem) !important;
}

.tarot-history-head h2 {
    margin: 0 !important;
    color: var(--qa-ink) !important;
    font-family: var(--font-display) !important;
    font-size: clamp(1.05rem, 2vw, 1.28rem) !important;
    font-weight: 720 !important;
    line-height: 1.2 !important;
}

.tarot-history-clear {
    appearance: none;
    min-height: 36px;
    padding: 0.35rem 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: var(--qa-muted) !important;
    background: transparent !important;
    box-shadow: none !important;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 620;
    cursor: pointer;
    transition: color 140ms ease !important;
}

.tarot-history-clear:hover,
.tarot-history-clear:focus-visible {
    color: var(--qa-ink) !important;
}

.tarot-history-list,
.tarot-history-group,
.tarot-history-more,
.tarot-history-group-hidden {
    display: grid !important;
    gap: 0 !important;
}

.tarot-history-item {
    position: relative;
    display: block !important;
    min-width: 0;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-top: 1px solid var(--qa-line) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    filter: none !important;
    transform: none !important;
    transition: background-color 140ms ease !important;
}

.tarot-history-group > .tarot-history-item:first-child {
    border-top-color: transparent !important;
}

.tarot-history-open {
    appearance: none;
    width: 100%;
    min-width: 0;
    min-height: 76px;
    display: grid;
    grid-template-columns: minmax(8.5rem, 0.52fr) minmax(0, 1.48fr) 22px;
    align-items: center;
    gap: clamp(0.9rem, 2.4vw, 1.6rem);
    padding: 0.9rem 0.15rem;
    border: 0;
    border-radius: 0;
    color: var(--qa-ink);
    background: transparent;
    box-shadow: none;
    text-align: left;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tarot-history-item:hover,
.tarot-history-item:focus-within {
    background: rgba(
        calc(113 - 42 * var(--theme-progress)),
        calc(132 - 45 * var(--theme-progress)),
        calc(164 - 51 * var(--theme-progress)),
        calc(0.055 + 0.025 * var(--theme-progress))
    ) !important;
    box-shadow: none !important;
    transform: none !important;
}

.tarot-history-time {
    color: var(--qa-muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
    white-space: nowrap;
}

.tarot-history-copy {
    min-width: 0;
    display: grid;
    gap: 0.22rem;
}

.tarot-history-copy strong {
    min-width: 0;
    overflow: hidden;
    color: var(--qa-ink) !important;
    font-size: 0.95rem !important;
    font-weight: 680 !important;
    line-height: 1.4 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tarot-history-copy > span {
    min-width: 0;
    overflow: hidden;
    color: var(--qa-muted) !important;
    font-size: 0.82rem;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tarot-history-arrow {
    width: 19px;
    height: 19px;
    color: var(--qa-muted);
    transform: translate3d(0, 0, 0);
    transition: color 140ms ease, transform 160ms ease !important;
}

.tarot-history-open:hover .tarot-history-arrow,
.tarot-history-open:focus-visible .tarot-history-arrow {
    color: var(--qa-ink);
    transform: translate3d(3px, 0, 0);
}

.tarot-history-more {
    border-top: 1px solid var(--qa-line);
}

.tarot-history-more:not([open]) .tarot-history-group-hidden {
    display: none !important;
}

.tarot-history-more-toggle {
    min-height: 44px !important;
    width: fit-content;
    display: inline-flex !important;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.1rem !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: var(--qa-muted) !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 0.82rem !important;
    font-weight: 620 !important;
    list-style: none;
    cursor: pointer;
}

.tarot-history-more-toggle::before {
    width: 0.38rem !important;
    height: 0.38rem !important;
    transition: transform 160ms ease !important;
}

.tarot-history-more-count {
    min-width: 0 !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: inherit !important;
    background: transparent !important;
    font-size: inherit !important;
}

.tarot-result {
    scroll-margin-top: 6rem;
}

@media (max-width: 760px) {
    .tarot-history {
        margin-top: 2.5rem !important;
        padding: 0.9rem 0 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .tarot-history-head {
        display: flex !important;
        align-items: center !important;
        padding-bottom: 0.55rem !important;
    }

    .tarot-history-head h2 {
        font-size: 1rem !important;
    }

    .tarot-history-open {
        min-height: 72px;
        grid-template-columns: minmax(0, 1fr) 20px;
        gap: 0.65rem;
        padding: 0.78rem 0.1rem;
    }

    .tarot-history-time {
        grid-column: 1;
        grid-row: 2;
        font-size: 0.72rem;
    }

    .tarot-history-copy {
        grid-column: 1;
        grid-row: 1;
    }

    .tarot-history-arrow {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .tarot-history-copy strong {
        font-size: 0.9rem !important;
    }

    .tarot-history-copy > span {
        font-size: 0.78rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-history-item,
    .tarot-history-clear,
    .tarot-history-arrow,
    .tarot-history-more-toggle::before {
        transition: none !important;
    }
}

/* Dark surfaces: restrained directional light, never floating white blooms. */
html[data-theme="dark"]::before,
html[data-theme="dark"]::after,
html[data-theme="dark"] body::before,
html[data-theme="dark"] body::after {
    display: none !important;
    opacity: 0 !important;
    background: none !important;
    filter: none !important;
}

html[data-theme="dark"] .page-hero::before,
html[data-theme="dark"] .hero-home-clean::before {
    inset: -4% -3% !important;
    background: linear-gradient(
        180deg,
        rgba(77, 92, 118, 0.08),
        rgba(31, 39, 53, 0.025) 48%,
        transparent 82%
    ) !important;
    filter: none !important;
    opacity: 1 !important;
}

html[data-theme="dark"] .glass-card::before,
html[data-theme="dark"] .note-card::before,
html[data-theme="dark"] .article::before,
html[data-theme="dark"] .reading-box::before,
html[data-theme="dark"] .comment-card::before,
html[data-theme="dark"] .comment-form-wrap-v4::before,
html[data-theme="dark"] .comments-compose-panel::before,
html[data-theme="dark"] .tarot-table::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 32%) !important;
    opacity: 1 !important;
    filter: none !important;
}

html[data-theme="dark"] .glass-card::after,
html[data-theme="dark"] .note-card::after,
html[data-theme="dark"] .article::after,
html[data-theme="dark"] .reading-box::after,
html[data-theme="dark"] .comment-card::after,
html[data-theme="dark"] .comment-form-wrap-v4::after,
html[data-theme="dark"] .comments-compose-panel::after,
html[data-theme="dark"] .tarot-table::after {
    display: none !important;
}

.theme-toggle {
    --toggle-icon: 20px;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, calc(0.62 - var(--theme-progress) * 0.48)) !important;
    border-radius: 50% !important;
    background: rgba(calc(255 - var(--theme-progress) * 235), calc(255 - var(--theme-progress) * 232), calc(255 - var(--theme-progress) * 226), calc(0.74 + var(--theme-progress) * 0.04)) !important;
    box-shadow: inset 0 1px rgba(255,255,255,calc(0.82 - var(--theme-progress) * 0.68)), 0 10px 28px rgba(22,34,54,calc(0.1 + var(--theme-progress) * 0.12)) !important;
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    transition: background-color 260ms ease, border-color 260ms ease, box-shadow 260ms ease, transform 180ms var(--qa-ease) !important;
}

.theme-toggle:hover { transform: translateY(-1px); }
.theme-toggle:active { transform: scale(0.94); }

.theme-toggle-track {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    box-shadow: none !important;
}

.theme-toggle__around {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    width: var(--toggle-icon) !important;
    height: var(--toggle-icon) !important;
    color: rgb(calc(226 - var(--theme-progress) * 13), calc(160 + var(--theme-progress) * 56), calc(52 + var(--theme-progress) * 181)) !important;
    opacity: calc(1 - var(--theme-progress)) !important;
    filter: none !important;
    transform: translate3d(-50%, -50%, 0) rotate(calc(var(--theme-progress) * 150deg)) !important;
    transform-origin: center !important;
    transition: transform 260ms var(--qa-ease), color 260ms ease, opacity 180ms ease !important;
}

.theme-toggle-moon {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--toggle-icon);
    height: var(--toggle-icon);
    pointer-events: none;
    opacity: var(--theme-progress);
    transform: translate3d(-50%, -50%, 0) scale(calc(0.82 + var(--theme-progress) * 0.18)) rotate(calc(-16deg + var(--theme-progress) * 16deg));
    transform-origin: center;
    transition: transform 260ms var(--qa-ease), opacity 180ms ease;
}

.theme-toggle-moon svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.theme-toggle-moon-earthshine {
    fill: rgba(169, 183, 205, 0.24);
}

.theme-toggle-moon-lit {
    fill: rgb(241, 228, 187);
    filter: drop-shadow(0 0 3px rgba(241, 228, 187, 0.3));
}

.theme-toggle-moon-craters {
    fill: rgba(93, 104, 123, 0.34);
    opacity: calc(0.34 + var(--moon-illumination, 0.5) * 0.28);
}

.theme-toggle-moon-edge {
    fill: none;
    stroke: rgba(224, 232, 243, 0.58);
    stroke-width: 0.72;
}

.theme-toggle.is-clicking { animation: qa-theme-button-pop 260ms var(--qa-ease); }

@keyframes qa-theme-button-pop {
    0% { transform: scale(1); }
    45% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

@media (min-width: 761px) and (max-width: 980px) {
    .page-hero h1,
    .tarot-hero-copy h1 {
        font-size: 3rem !important;
        line-height: 1.05 !important;
        letter-spacing: 0 !important;
    }

    .article > h1 {
        max-width: 14ch !important;
        font-size: 3.4rem !important;
        line-height: 1.04 !important;
        letter-spacing: 0 !important;
    }

    .home-story-copy h3 {
        font-size: 3.6rem !important;
        line-height: 1.02 !important;
    }
}

@media (max-width: 760px) {
    body {
        font-size: 16px !important;
        line-height: 1.6 !important;
    }

    .site-header {
        min-height: 56px !important;
        padding: 0.55rem 0.72rem !important;
    }

    .site-header .brand { font-size: 0.8rem !important; }

    .site-header .header-actions {
        gap: 0.34rem !important;
        transform: none !important;
    }

    .theme-toggle {
        --toggle-icon: 18px;
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
    }

    .lang-toggle {
        min-height: 38px !important;
        padding: 0 0.72rem !important;
        font-size: 0.8rem !important;
    }

    .page-shell {
        width: min(100% - 1.25rem, 42rem) !important;
        padding-top: 5.4rem !important;
    }

    body.home .page-shell {
        width: 100% !important;
        padding-top: 0 !important;
    }

    .home-film-copy {
        left: 1.25rem !important;
        right: 1.25rem !important;
        bottom: 6.3rem !important;
    }

    .home-film-kicker {
        margin-bottom: 0.75rem !important;
        font-size: 0.78rem !important;
    }

    .home-film-copy h1 {
        max-width: 8ch !important;
        font-size: 3.1rem !important;
        line-height: 0.98 !important;
        letter-spacing: 0 !important;
    }

    .home-film-copy p {
        max-width: 22rem !important;
        margin-top: 0.85rem !important;
        font-size: 0.96rem !important;
        line-height: 1.55 !important;
    }

    .home-scroll-cue,
    .home-video-toggle { min-height: 42px !important; }

    .home-story-stream {
        width: min(100% - 1.25rem, 42rem) !important;
        padding: 4.4rem 0 6rem !important;
    }

    .home-story-intro { margin-bottom: 2rem !important; }
    .home-story-intro > span { font-size: 0.76rem !important; }

    .home-story-intro h2 {
        margin-top: 0.45rem !important;
        font-size: 2.5rem !important;
        line-height: 1.02 !important;
        letter-spacing: 0 !important;
    }

    .home-story-intro p {
        margin-top: 0.75rem !important;
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }

    .home-story {
        min-height: 26rem !important;
        border-radius: 24px !important;
    }

    .home-story-link { padding: 1.15rem !important; }

    .home-story-copy h3 {
        max-width: 12ch !important;
        font-size: 2.25rem !important;
        line-height: 1.04 !important;
        letter-spacing: 0 !important;
    }

    .home-story-copy p {
        margin-top: 0.8rem !important;
        font-size: 0.96rem !important;
        line-height: 1.62 !important;
    }

    .home-story-action {
        min-height: 44px !important;
        margin-top: 1rem !important;
        padding: 0 0.95rem !important;
    }

    .page-hero {
        min-height: 0 !important;
        padding: 1.1rem 0.5rem 1.55rem !important;
        background: transparent !important;
    }

    .page-hero .eyebrow,
    .tarot-hero-copy .hero-kicker { font-size: 0.78rem !important; }

    .page-hero h1,
    .tarot-hero-copy h1 {
        max-width: 100% !important;
        margin-top: 0.55rem !important;
        font-size: 2.4rem !important;
        line-height: 1.06 !important;
        letter-spacing: 0 !important;
        overflow-wrap: normal !important;
        word-break: keep-all !important;
    }

    .page-hero > p,
    .tarot-hero-copy > p {
        margin-top: 0.72rem !important;
        font-size: 0.96rem !important;
        line-height: 1.65 !important;
    }

    .notes-page-grid {
        gap: 0.72rem !important;
        padding-top: 0 !important;
    }

    .note-card {
        min-height: 0 !important;
        padding: 1rem !important;
        border-radius: 20px !important;
    }

    .note-card-date { font-size: 0.76rem !important; }

    .note-card h2,
    .note-card h3 {
        margin-top: 0.7rem !important;
        font-size: 1.14rem !important;
        line-height: 1.35 !important;
        letter-spacing: 0 !important;
    }

    .note-card p {
        margin-top: 0.5rem !important;
        font-size: 0.94rem !important;
        line-height: 1.6 !important;
    }

    .note-card-link {
        margin-top: 0.7rem !important;
        font-size: 0.86rem !important;
    }

    .article {
        width: 100% !important;
        padding: 0.7rem 0.85rem 1.5rem !important;
        border-radius: 22px !important;
    }

    .article-meta-row {
        align-items: center !important;
        margin-bottom: 0 !important;
    }

    .article-kicker,
    .article-back-link,
    .article-translate-toggle { font-size: 0.78rem !important; }

    .article > h1 {
        max-width: 12ch !important;
        margin-top: 1.45rem !important;
        font-size: 2.25rem !important;
        line-height: 1.08 !important;
        letter-spacing: 0 !important;
        overflow-wrap: normal !important;
        word-break: keep-all !important;
    }

    .article-content {
        gap: 0 !important;
        font-family: var(--font-ui) !important;
        font-size: 1rem !important;
        line-height: 1.82 !important;
    }

    .article-content p,
    .article-content li {
        color: var(--qa-ink) !important;
        font-size: 1rem !important;
        line-height: 1.82 !important;
    }

    .article-content > p:first-of-type {
        color: var(--qa-muted) !important;
        font-size: 1.03rem !important;
        line-height: 1.75 !important;
    }

    .article-content h2 {
        margin-top: 2.35rem !important;
        margin-bottom: 0.75rem !important;
        font-size: 1.55rem !important;
        line-height: 1.24 !important;
        letter-spacing: 0 !important;
    }

    .article-content h3 {
        margin-top: 2rem !important;
        font-size: 1.15rem !important;
        line-height: 1.35 !important;
    }

    .article-content blockquote {
        margin: 1.6rem 0 !important;
        padding-left: 1rem !important;
    }

    .article-content blockquote p {
        font-size: 1.05rem !important;
        line-height: 1.7 !important;
    }

    .article-source-list {
        gap: 0.55rem !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .article-source-list li,
    .article-source-list a {
        font-size: 0.9rem !important;
        line-height: 1.55 !important;
    }

    .comments-shell {
        width: 100% !important;
        margin-top: 2.5rem !important;
        padding: 0 !important;
    }

    .comments-topbar {
        align-items: flex-end !important;
        gap: 0.75rem !important;
        padding: 0 0.2rem 1rem !important;
        border: 0 !important;
    }

    .comments-topbar h2 {
        font-size: 1.38rem !important;
        line-height: 1.2 !important;
    }

    .comments-topbar > p {
        font-size: 0.85rem !important;
        line-height: 1.45 !important;
    }

    .comments-grid { display: block !important; }
    .comments-empty-inline { display: none !important; }

    .comments-compose-panel {
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .comment-form-wrap-v4 {
        padding: 1rem !important;
        border: 1px solid var(--qa-line) !important;
        border-radius: 20px !important;
        background: var(--qa-surface) !important;
        box-shadow: 0 16px 42px rgba(22,34,54,calc(0.08 + var(--theme-progress) * 0.1)) !important;
    }

    .comment-compose-head strong { font-size: 1.18rem !important; }
    .comment-compose-head p { font-size: 0.86rem !important; }
    .comment-reply-title { display: none !important; }

    .comment-form label {
        color: var(--qa-muted) !important;
        font-size: 0.86rem !important;
    }

    .comment-form textarea {
        width: 100% !important;
        height: 8.5rem !important;
        min-height: 8.5rem !important;
        padding: 0.9rem !important;
        border-radius: 16px !important;
        color: var(--qa-ink) !important;
        background: rgba(255,255,255,calc(0.7 - var(--theme-progress) * 0.58)) !important;
        font-family: var(--font-ui) !important;
        font-size: 1rem !important;
        line-height: 1.65 !important;
    }

    .comment-form input[type="submit"],
    .comment-form button[type="submit"] {
        width: 100% !important;
        min-height: 44px !important;
        border-radius: 999px !important;
        font-size: 0.9rem !important;
    }

    .tarot-stage {
        width: 100% !important;
        padding: 1rem 0 2rem !important;
    }

    .tarot-layout { gap: 0.8rem !important; }

    .tarot-form {
        padding: 1rem !important;
        border-radius: 20px !important;
    }

    .tarot-form label > span,
    .tarot-form-helper {
        font-size: 0.86rem !important;
        line-height: 1.5 !important;
    }

    .tarot-form textarea {
        min-height: 7.5rem !important;
        padding: 0.85rem !important;
        border-radius: 16px !important;
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }

    .tarot-form select {
        min-height: 48px !important;
        padding: 0.75rem 0.9rem !important;
        border-radius: 16px !important;
        font-size: 0.98rem !important;
    }

    .tarot-form button {
        min-height: 44px !important;
        font-size: 0.9rem !important;
    }

    .tarot-table {
        min-height: 560px !important;
        padding: 0.9rem !important;
        border-radius: 20px !important;
    }

    .tarot-table-head p,
    .tarot-selection-copy,
    .tarot-table-hint {
        font-size: 0.84rem !important;
        line-height: 1.5 !important;
    }

    /* Keep this last: earlier legacy mobile rules used a fixed 560px table. */
    .tarot-table {
        min-height: 0 !important;
        padding: 0.9rem 0.7rem 0.25rem !important;
    }
}

/* Contrast and elevation lock: keep text readable through the full theme transition. */
:root {
    --qa-ink: rgb(
        calc(17 + 222 * var(--theme-progress)),
        calc(24 + 217 * var(--theme-progress)),
        calc(36 + 208 * var(--theme-progress))
    );
    --qa-muted: rgb(
        calc(76 + 106 * var(--theme-progress)),
        calc(89 + 98 * var(--theme-progress)),
        calc(111 + 94 * var(--theme-progress))
    );
    --qa-line: rgba(
        calc(72 + 123 * var(--theme-progress)),
        calc(88 + 110 * var(--theme-progress)),
        calc(116 + 91 * var(--theme-progress)),
        calc(0.18 + 0.02 * var(--theme-progress))
    );
    --qa-raised-surface: linear-gradient(
        145deg,
        rgba(
            calc(255 - 225 * var(--theme-progress)),
            calc(255 - 220 * var(--theme-progress)),
            calc(255 - 211 * var(--theme-progress)),
            calc(0.94 - 0.08 * var(--theme-progress))
        ),
        rgba(
            calc(247 - 229 * var(--theme-progress)),
            calc(250 - 226 * var(--theme-progress)),
            calc(255 - 220 * var(--theme-progress)),
            calc(0.84 - 0.05 * var(--theme-progress))
        )
    );
    --qa-raised-shadow:
        inset 0 1px 0 rgba(255, 255, 255, calc(0.96 - 0.83 * var(--theme-progress))),
        inset 0 -1px 0 rgba(54, 70, 98, calc(0.055 + 0.03 * var(--theme-progress))),
        0 22px 52px rgba(30, 43, 66, calc(0.105 + 0.12 * var(--theme-progress))),
        0 4px 12px rgba(30, 43, 66, calc(0.045 + 0.06 * var(--theme-progress)));
}

body,
input,
select,
textarea {
    color: var(--qa-ink) !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.glass-card,
.note-card,
.tarot-form,
.reading-box,
.comment-card,
.comment-form-wrap-v4,
.comments-compose-panel,
.tarot-history,
.tarot-history-item {
    border: 1px solid rgba(255, 255, 255, calc(0.92 - 0.8 * var(--theme-progress))) !important;
    background: var(--qa-raised-surface) !important;
    box-shadow: var(--qa-raised-shadow) !important;
}

.glass-card:hover,
.note-card:hover,
.comment-card:hover,
.tarot-history-item:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, calc(0.98 - 0.84 * var(--theme-progress))),
        0 28px 64px rgba(30, 43, 66, calc(0.14 + 0.13 * var(--theme-progress))),
        0 6px 16px rgba(30, 43, 66, calc(0.055 + 0.06 * var(--theme-progress))) !important;
}

.hero-kicker,
.section-kicker,
.eyebrow,
.article-kicker,
.note-card-date,
.article-date,
.post-date,
.tarot-form label > span,
.tarot-form-helper,
.tarot-table-hint,
.tarot-selection-copy,
.tarot-hero-note,
.tarot-page-closing,
.ai-chat-head p,
.ai-chat-empty,
.ai-chat-remaining,
.comment-compose-head p,
.comment-form label {
    color: var(--qa-muted) !important;
}

.tarot-form label > span,
.comment-form label,
.ai-chat-head strong,
.spread-slot strong {
    font-weight: 680 !important;
}

.tarot-form textarea,
.tarot-form select,
.comment-form textarea,
.ai-chat-compose {
    border: 1px solid rgba(
        calc(75 + 116 * var(--theme-progress)),
        calc(91 + 103 * var(--theme-progress)),
        calc(120 + 82 * var(--theme-progress)),
        calc(0.2 + 0.03 * var(--theme-progress))
    ) !important;
    color: var(--qa-ink) !important;
    background: rgba(
        calc(255 - 237 * var(--theme-progress)),
        calc(255 - 233 * var(--theme-progress)),
        calc(255 - 227 * var(--theme-progress)),
        calc(0.78 - 0.06 * var(--theme-progress))
    ) !important;
    box-shadow:
        inset 0 1px 2px rgba(25, 38, 58, calc(0.045 + 0.11 * var(--theme-progress))),
        0 1px 0 rgba(255, 255, 255, calc(0.88 - 0.76 * var(--theme-progress))) !important;
}

.tarot-form textarea::placeholder,
.comment-form textarea::placeholder,
.ai-chat-compose textarea::placeholder {
    color: rgba(
        calc(80 + 101 * var(--theme-progress)),
        calc(93 + 96 * var(--theme-progress)),
        calc(115 + 87 * var(--theme-progress)),
        0.82
    ) !important;
    opacity: 1 !important;
}

[data-theme="light"] .tarot-table {
    border: 1px solid rgba(255, 255, 255, 0.95) !important;
    color: #172033 !important;
    background:
        radial-gradient(circle at 78% 14%, rgba(146, 166, 201, 0.16), transparent 34%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(244, 248, 254, 0.88)) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -1px 0 rgba(70, 89, 122, 0.07),
        0 26px 64px rgba(33, 48, 74, 0.13),
        0 5px 14px rgba(33, 48, 74, 0.055) !important;
}

[data-theme="light"] .tarot-table .section-kicker,
[data-theme="light"] .tarot-table-hint,
[data-theme="light"] .tarot-selection-copy {
    color: #53617a !important;
}

[data-theme="light"] .tarot-table-head {
    color: #172033 !important;
}

[data-theme="light"] .spread-slot {
    border-color: rgba(78, 98, 132, 0.17) !important;
    color: #172033 !important;
    background: rgba(255, 255, 255, 0.74) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.96),
        0 8px 20px rgba(43, 61, 91, 0.07) !important;
}

[data-theme="light"] .spread-slot > span:last-child {
    color: #62708a !important;
}

[data-theme="dark"] .tarot-table {
    color: #e9eef6 !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 28px 68px rgba(2, 7, 15, 0.34),
        0 5px 16px rgba(2, 7, 15, 0.2) !important;
}

[data-theme="dark"] .tarot-table .section-kicker,
[data-theme="dark"] .tarot-table-hint,
[data-theme="dark"] .tarot-selection-copy {
    color: #bdc8d8 !important;
}

[data-theme="dark"] .spread-slot > span:last-child {
    color: #aebbcf !important;
}

@media (max-width: 760px) {
    .glass-card,
    .note-card,
    .tarot-form,
    .reading-box,
    .comment-card,
    .comment-form-wrap-v4,
    .comments-compose-panel,
    .tarot-history,
    .tarot-history-item,
    .tarot-table {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, calc(0.94 - 0.8 * var(--theme-progress))),
            0 16px 38px rgba(30, 43, 66, calc(0.1 + 0.11 * var(--theme-progress))),
            0 3px 10px rgba(30, 43, 66, calc(0.04 + 0.05 * var(--theme-progress))) !important;
    }
}

/* Keep the archive treatment authoritative after the global surface rules above. */
.tarot-history {
    border: 0 !important;
    border-top: 1px solid var(--qa-line) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    filter: none !important;
}

.tarot-history.motion-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

[data-theme="light"] .tarot-history,
[data-theme="dark"] .tarot-history {
    border: 0 !important;
    border-top: 1px solid var(--qa-line) !important;
    background: transparent !important;
    box-shadow: none !important;
}

.tarot-history-item,
.tarot-history-item:hover,
.tarot-history-item:focus-within {
    border: 0 !important;
    border-top: 1px solid var(--qa-line) !important;
    border-radius: 0 !important;
    background-image: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    filter: none !important;
    transform: none !important;
}

[data-theme="light"] .tarot-history-item,
[data-theme="dark"] .tarot-history-item {
    border: 0 !important;
    border-top: 1px solid var(--qa-line) !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.tarot-history-group > .tarot-history-item:first-child {
    border-top-color: transparent !important;
}

.tarot-history-item:hover,
.tarot-history-item:focus-within {
    background-color: rgba(
        calc(113 - 42 * var(--theme-progress)),
        calc(132 - 45 * var(--theme-progress)),
        calc(164 - 51 * var(--theme-progress)),
        calc(0.055 + 0.025 * var(--theme-progress))
    ) !important;
}

.tarot-history-more-toggle [data-history-more-label],
.tarot-history-more-toggle .tarot-history-more-count {
    min-width: 0 !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: inherit !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: inherit !important;
}

@media (max-width: 760px) {
    .tarot-history,
    .tarot-history-item,
    .tarot-history-item:hover,
    .tarot-history-item:focus-within {
        border-radius: 0 !important;
        box-shadow: none !important;
    }
}
