/* ==========================================================================
   SageDeck — flow.css
   The reading flow and its dialogs: card selection, loading,
   the reading, the card panel, summary, full and shared readings, locked
   readings, the account menu and every dialog's contents.
   Written on the site.css tokens in Phase 2 (2026-10), replacing the legacy
   styles.css for index.html. The deck and card pages still load styles.css
   until Phase 3.
   Loaded after site.css (tokens, base, shared components), before app.css.
   ========================================================================== */

/* ---------- Screens ---------- */

.container {
    max-width: 1400px;
    min-height: 100vh;
    margin: 0 auto;
    padding: var(--space-4);
}

@media (min-width: 600px) {
    .container { padding: var(--space-5); }
}

.screen {
    display: none;
    width: 100%;
    padding: var(--space-4) 0;
    animation: screenEnter var(--dur-4) var(--ease-out);
}

.screen.active { display: block; }

@keyframes screenEnter {
    from { opacity: 0; transform: translateY(10px); }
}

.content-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.screen-title {
    margin-bottom: var(--space-2);
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: var(--step-4);
    font-weight: 600;
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-display);
    text-align: center;
    text-wrap: balance;
}

.screen-subtitle {
    margin-bottom: var(--space-5);
    color: var(--color-text-2);
    font-size: var(--step--1);
    line-height: var(--lh-body);
    text-align: center;
}

.screen-subtitle strong { color: var(--color-text); font-weight: 600; }

.fade-in { animation: fadeIn 0.5s var(--ease-out) forwards; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Buttons ---------- */

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 48px;
    padding: 0 var(--space-6);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: var(--step-0);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out),
                color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}

.primary-button:active,
.secondary-button:active { transform: translateY(1px); }

.primary-button {
    background: var(--gradient-gold);
    color: var(--color-on-gold);
    box-shadow: var(--shadow-1);
}

.primary-button:hover:not(:disabled) { background: var(--color-gold-hover); box-shadow: var(--glow-gold); }

.primary-button:disabled { opacity: 0.5; cursor: not-allowed; }

.secondary-button {
    background: transparent;
    border-color: var(--color-border-strong);
    color: var(--color-gold);
}

.secondary-button:hover { border-color: var(--color-gold); background: rgba(215, 195, 130, 0.08); }

.button-group {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

/* Eyebrow labels used across the flow */
.summary-title,
.action-label,
.reading-panel-theme,
.rd-eyebrow,
.rd-section-title,
.rd-theme,
.synthesis-moment-hint {
    font-family: var(--font-body);
    font-size: var(--step--2);
    font-weight: 600;
    letter-spacing: var(--tracking-eyebrow);
    text-transform: uppercase;
}

:is(:lang(th), :lang(ko), :lang(zh), :lang(ja)) :is(.summary-title, .action-label, .reading-panel-theme, .rd-eyebrow, .rd-section-title, .rd-theme, .synthesis-moment-hint) {
    letter-spacing: 0;
    text-transform: none;
}

/* ---------- Card selection ---------- */

.card-selection-wrapper { padding-bottom: 120px; }

.card-grid {
    position: relative;
    width: 100%;
    margin: var(--space-4) 0;
}

.card-item {
    display: block;
    position: relative;
    padding: 0;
    border: 0;
    border-radius: 6px;
    overflow: hidden;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow var(--dur-2) var(--ease-out), opacity var(--dur-2) var(--ease-out), filter var(--dur-2) var(--ease-out);
}

.card-item-positioned { position: absolute; }

.card-item:not(.is-focused):hover {
    z-index: 300 !important;
    box-shadow: 0 0 0 1.5px var(--gold), 0 10px 28px rgba(215, 195, 130, 0.35);
    filter: brightness(1.12);
}

.card-item.selected {
    z-index: 299 !important;
    box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(215, 195, 130, 0.55);
    filter: brightness(1.15);
}

.card-item.selected::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 10;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23081020' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 13px no-repeat;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.card-item.disabled { opacity: 0.32; cursor: not-allowed; }

.card-back {
    position: relative;
    width: 100%;
    height: 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Deal-in: cards cascade onto the table, then breathe on their own rhythm.
   All motion is on .card-back so it never fights the outer rotation. */
.card-item-positioned .card-back {
    opacity: 0;
    animation:
        cardDealIn 0.55s cubic-bezier(0.25, 0.8, 0.35, 1.15) var(--deal-delay, 0ms) forwards,
        cardBreathe var(--breathe-dur, 7s) ease-in-out calc(var(--deal-delay, 0ms) + var(--breathe-delay, 0s) + 0.6s) infinite;
}

@keyframes cardDealIn {
    from { opacity: 0; transform: translateY(16px) scale(0.92); }
    to { opacity: 1; transform: none; }
}

@keyframes cardBreathe {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2.5px); }
}

.card-item:not(.is-focused):hover .card-back {
    animation-play-state: paused, paused;
    transform: translateY(-4px) scale(1.06);
    transition: transform 0.25s cubic-bezier(0.3, 0.9, 0.4, 1.2);
}

.card-item.selected .card-back { animation: cardSelectPop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) forwards; }

@keyframes cardSelectPop {
    0% { opacity: 1; transform: scale(1); }
    45% { opacity: 1; transform: scale(1.14); }
    100% { opacity: 1; transform: scale(1.05); }
}

/* Sticky bar under the spread */
.card-selection-bottom-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-7) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(8, 16, 32, 0.97) 0%, rgba(8, 16, 32, 0.9) 55%, rgba(8, 16, 32, 0) 100%);
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
    transition: transform 0.4s var(--ease-out), opacity var(--dur-3) ease;
}

.card-selection-bottom-bar.visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.back-button-small {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: rgba(17, 35, 57, 0.8);
    color: var(--color-text-2);
    cursor: pointer;
    transition: border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out);
}

.back-button-small:hover { border-color: var(--color-border-strong); color: var(--color-gold); }

.reveal-button {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    max-width: 320px;
    min-height: 52px;
    padding: 0 var(--space-6);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: var(--gradient-gold);
    color: var(--color-on-gold);
    font-family: var(--font-body);
    font-size: var(--step-0);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(215, 195, 130, 0.35);
    transition: background-color var(--dur-3) var(--ease-out), color var(--dur-3) var(--ease-out),
                box-shadow var(--dur-3) var(--ease-out), transform var(--dur-2) var(--ease-out);
}

.reveal-button:disabled {
    border-color: var(--color-border);
    background: var(--color-surface-2);
    color: var(--color-text-2);
    box-shadow: none;
    cursor: default;
}

.reveal-button:not(:disabled) { animation: revealPulse 2.4s ease-in-out infinite; }

.reveal-button:not(:disabled):hover { background: var(--color-gold-hover); transform: translateY(-1px); }

@keyframes revealPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(215, 195, 130, 0.3); }
    50% { box-shadow: 0 4px 32px rgba(215, 195, 130, 0.6); }
}

.selection-status {
    max-width: 520px;
    margin: 0 auto var(--space-4);
    color: var(--color-gold-hover);
    font-size: var(--step--1);
    line-height: var(--lh-body);
    text-align: center;
}

/* ---------- Locked reading notice and screen ---------- */

.locked-notice {
    max-width: 520px;
    margin: 0 auto var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-m);
    background: var(--color-purple-soft);
    color: var(--color-text);
    font-size: var(--step--1);
    line-height: var(--lh-body);
    text-align: center;
}

.locked-wrapper {
    max-width: 640px;
    padding: var(--space-5) 0 var(--space-7);
    text-align: center;
}

.locked-cards {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    margin: var(--space-5) 0 var(--space-6);
}

.locked-cards img {
    width: 17%;
    max-width: 96px;
    height: auto;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-s);
    filter: blur(3px) brightness(0.55);
}

.locked-cards img.open {
    filter: none;
    box-shadow: 0 0 0 2px var(--gold), var(--shadow-2);
}

.locked-first {
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-l);
    background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface-1));
    text-align: start;
}

.locked-first h3 {
    margin-bottom: var(--space-1);
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: var(--step-2);
    font-weight: 600;
}

.locked-first .locked-anchor {
    margin-bottom: var(--space-3);
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-style: italic;
    line-height: var(--lh-snug);
}

.locked-first p {
    color: var(--color-text);
    font-size: var(--step-0);
    line-height: var(--lh-reading);
}

.locked-rest { margin-top: var(--space-6); }

.locked-rest p {
    margin-bottom: var(--space-4);
    color: var(--color-text-2);
    font-size: var(--step-0);
    line-height: var(--lh-body);
}

/* ---------- Loading ---------- */

.mystical-loading {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: var(--space-7) var(--space-5);
    transition: opacity 0.5s ease;
}

.floating-cards-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 200px;
}

.floating-card {
    position: absolute;
    width: 68px;
    height: 102px;
    border: 1px solid rgba(215, 195, 130, 0.55);
    border-radius: 7px;
    background: var(--color-surface-3) center / cover no-repeat;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 24px rgba(215, 195, 130, 0.22);
}

.card-1 { animation: shuffleOrbit 4.2s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
.card-2 { animation: shuffleOrbit 4.2s cubic-bezier(0.45, 0, 0.55, 1) 0.84s infinite; }
.card-3 { animation: shuffleOrbit 4.2s cubic-bezier(0.45, 0, 0.55, 1) 1.68s infinite; }
.card-4 { animation: shuffleOrbit 4.2s cubic-bezier(0.45, 0, 0.55, 1) 2.52s infinite; }
.card-5 { animation: shuffleOrbit 4.2s cubic-bezier(0.45, 0, 0.55, 1) 3.36s infinite; }

@keyframes shuffleOrbit {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); z-index: 5; }
    20% { transform: translate(84px, -46px) rotate(14deg) scale(0.96); }
    45% { transform: translate(0, -92px) rotate(0deg) scale(0.9); z-index: 1; }
    70% { transform: translate(-84px, -46px) rotate(-14deg) scale(0.96); }
    100% { transform: translate(0, 0) rotate(0deg) scale(1); z-index: 5; }
}

.mystical-glow {
    position: absolute;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(112, 48, 160, 0.3) 0%, rgba(215, 195, 130, 0.1) 40%, transparent 70%);
    pointer-events: none;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.mystical-message {
    margin-top: var(--space-7);
    color: var(--color-text-2);
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-style: italic;
    text-align: center;
    transition: opacity var(--dur-3) ease;
}

.loading-error {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--space-7) var(--space-5);
    text-align: center;
}

.loading-error p {
    margin-bottom: var(--space-2);
    color: var(--color-text);
    font-size: var(--step-0);
    line-height: var(--lh-body);
}

.error-icon {
    margin-bottom: var(--space-4);
    color: var(--color-gold);
    font-size: 2rem;
}

.error-detail {
    margin-bottom: var(--space-5);
    color: var(--color-text-3) !important;
    font-size: var(--step--1) !important;
}

.retry-button {
    min-height: 44px;
    padding: 0 var(--space-5);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-gold);
    font-weight: 600;
    cursor: pointer;
}

.retry-button:hover { border-color: var(--color-gold); background: rgba(215, 195, 130, 0.08); }

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(215, 195, 130, 0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- The reading ---------- */

#readingScreen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.reading-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: var(--space-7);
    text-align: center;
}

.reading-wrapper .screen-title { padding-inline: 48px; }

.reading-question {
    max-width: 36ch;
    margin: 0 auto var(--space-5);
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-style: italic;
    line-height: var(--lh-snug);
    text-wrap: balance;
}

.sound-toggle {
    position: absolute;
    top: 2px;
    right: 0;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: rgba(17, 35, 57, 0.6);
    color: var(--color-text-2);
    cursor: pointer;
    transition: border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}

.sound-toggle:hover { border-color: var(--color-border-strong); color: var(--color-gold); }
.sound-toggle[aria-pressed="true"] { color: var(--color-gold); }
.sound-toggle .icon { width: 18px; height: 18px; }

.reading-cards-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    min-height: 400px;
    margin: 0 auto;
}

.reading-card-wrapper {
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform var(--dur-3) ease, box-shadow var(--dur-3) ease;
}

.reading-card-wrapper:not(.is-focused):hover {
    z-index: 100 !important;
    transform: scale(1.05) !important;
}

.reading-card-wrapper:focus-visible { outline-offset: 4px; }

/* 3D flip */
.reading-card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.85s cubic-bezier(0.34, 1.3, 0.5, 1);
}

.reading-card[data-flipped="true"] { transform: rotateY(180deg); }

.reading-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.reading-card-back,
.reading-card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background-position: center;
    background-size: cover;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.reading-card-front {
    overflow: hidden;
    transform: rotateY(180deg);
}

/* Light sweep across the face as it turns */
.reading-card-front::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 245, 215, 0) 42%, rgba(255, 245, 215, 0.55) 50%, rgba(255, 245, 215, 0) 58%, transparent 70%);
    transform: translateX(-130%);
    pointer-events: none;
}

.reading-card[data-flipped="true"] .reading-card-front::after {
    animation: cardLightSweep 1.1s cubic-bezier(0.5, 0, 0.3, 1) 0.45s 1 forwards;
}

@keyframes cardLightSweep {
    from { transform: translateX(-130%); }
    to { transform: translateX(130%); }
}

.tap-hint {
    padding: var(--space-4);
    color: var(--color-text-2);
    font-size: var(--step--1);
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.tap-hint.visible { opacity: 1; }

/* ---------- Card panel ---------- */

.card-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay, 1000);
    background: rgba(4, 8, 16, 0.86);
    transition: background-color var(--dur-3) ease;
}

/* Desktop: beside the enlarged card, as tall as the card or taller.
   showReadingPanel() sets left, width and min-height. */
.card-detail-content {
    position: fixed;
    top: 50%;
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 48px);
    opacity: 0;
    transform: translateY(-50%);
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.card-detail-content.visible {
    opacity: 1;
    pointer-events: auto;
}

.reading-panel-side {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    padding: var(--space-6);
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-l);
    background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface-1));
    box-shadow: var(--shadow-3);
    text-align: start;
}

.reading-panel-side:focus { outline: none; }

.reading-panel-title {
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: var(--step-3);
    font-weight: 600;
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-display);
    opacity: 0;
}

.reading-panel-anchor {
    margin: var(--space-2) 0 var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-style: italic;
    font-weight: 500;
    line-height: var(--lh-snug);
    opacity: 0;
}

.reading-panel-interpretation {
    min-height: 50px;
    color: var(--color-text);
    font-size: var(--step-0);
    line-height: var(--lh-reading);
}

.reading-panel-theme {
    margin-top: var(--space-5);
    color: var(--color-text-3);
    opacity: 0;
}

.sentence-reveal {
    opacity: 0;
    animation: sentenceUp 0.6s cubic-bezier(0.25, 0.6, 0.3, 1) forwards;
}

@keyframes sentenceUp {
    to { opacity: 1; }
}

/* Phones: the card sits at the top, the panel fills the space below it.
   showReadingPanelMobile() sets top and max-height. */
@media (max-width: 767px) {
    .card-detail-content {
        right: 16px;
        left: 16px;
        width: auto;
        transform: none;
    }

    .reading-panel-side { padding: var(--space-5); }

    .reading-panel-title { font-size: var(--step-2); }

    .reading-panel-anchor {
        margin: var(--space-1) 0 var(--space-3);
        padding-bottom: var(--space-3);
        font-size: var(--step-0);
    }

    .reading-panel-interpretation { font-size: var(--step--1); }

    .reading-panel-theme { margin-top: var(--space-4); }
}

/* ---------- Synthesis moment ---------- */

.synthesis-moment {
    position: fixed;
    inset: 0;
    z-index: var(--z-moment, 1500);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-7) var(--space-5);
    background: radial-gradient(ellipse at 50% 45%, rgba(112, 48, 160, 0.28), transparent 60%), rgba(4, 8, 20, 0.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.65s ease;
}

.synthesis-moment.active {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

.synthesis-moment-inner {
    max-width: 640px;
    text-align: center;
}

.synthesis-moment-ornament {
    margin-bottom: var(--space-6);
    color: var(--color-gold);
    font-size: 1.5rem;
    text-shadow: 0 0 24px rgba(215, 195, 130, 0.6);
    opacity: 0;
    transform: scale(0.6);
}

.synthesis-moment.active .synthesis-moment-ornament {
    animation: momentOrnament 0.9s cubic-bezier(0.34, 1.4, 0.5, 1) 0.15s forwards;
}

@keyframes momentOrnament {
    to { opacity: 1; transform: scale(1); }
}

.synthesis-moment-quote {
    color: var(--cream);
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 1.2rem + 2.4vw, 2.5rem);
    font-style: italic;
    font-weight: 500;
    line-height: 1.3;
    text-shadow: 0 0 40px rgba(215, 195, 130, 0.3);
    text-wrap: balance;
    opacity: 0;
    transform: translateY(14px);
}

.synthesis-moment.active .synthesis-moment-quote {
    animation: momentQuote 1.1s cubic-bezier(0.25, 0.7, 0.3, 1) 0.5s forwards;
}

@keyframes momentQuote {
    to { opacity: 1; transform: none; }
}

.synthesis-moment-hint {
    margin-top: var(--space-6);
    color: var(--color-text-3);
    opacity: 0;
}

.synthesis-moment.active .synthesis-moment-hint { animation: fadeIn 0.8s ease 1.6s forwards; }

/* ---------- Summary (under the cards) ---------- */

.summary-section {
    width: 100%;
    max-width: 680px;
    margin: var(--space-6) auto 0;
    padding: var(--space-6) var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-l);
    background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface-1));
    box-shadow: var(--shadow-3);
    text-align: start;
    scroll-margin-top: calc(var(--header-h) + var(--space-4));
}

@media (min-width: 600px) {
    .summary-section { padding: var(--space-7); }
}

.summary-title {
    margin-bottom: var(--space-4);
    color: var(--color-gold);
    text-align: center;
}

.quotable-line {
    max-width: 30ch;
    margin: 0 auto var(--space-6);
    color: var(--color-gold-hover);
    font-family: var(--font-heading);
    font-size: var(--step-2);
    font-style: italic;
    font-weight: 500;
    line-height: var(--lh-snug);
    text-align: center;
    text-wrap: balance;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.quotable-line.visible { opacity: 1; transform: none; }

.quotable-line::before { content: '\201C'; }
.quotable-line::after { content: '\201D'; }

.summary-text {
    margin-bottom: var(--space-6);
    color: var(--color-text);
    font-size: var(--step-0);
    line-height: var(--lh-reading);
}

.action-section {
    margin: 0 0 var(--space-6);
    padding: var(--space-4) var(--space-5);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-s);
    background: var(--color-purple-soft);
    text-align: start;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.action-section.visible { opacity: 1; transform: none; }

.action-label {
    display: block;
    margin-bottom: var(--space-1);
    color: var(--color-gold);
}

.action-text {
    color: var(--color-text);
    font-size: var(--step-0);
    line-height: var(--lh-body);
}

/* "2 free readings left" */
.free-readings-note {
    margin: calc(var(--space-2) * -1) 0 var(--space-5);
    color: var(--color-text-2);
    font-size: var(--step--1);
    line-height: var(--lh-body);
    text-align: center;
}

.free-note-cta {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-gold);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.summary-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.summary-buttons.visible { opacity: 1; }

@media (max-width: 599px) {
    .summary-buttons > * { width: 100%; }
}

.support-note {
    max-width: 640px;
    margin: 0 auto var(--space-6);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-m);
    background: rgba(215, 195, 130, 0.06);
    color: var(--color-text);
    font-size: var(--step--1);
    line-height: var(--lh-body);
    text-align: start;
}

/* ---------- Reading document (full, shared and past readings) ---------- */
/* Built by renderReadingDocument() in app.js. */

.rd {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--space-4) 0 var(--space-7);
}

.rd-head {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--color-border-subtle);
    text-align: center;
}

.rd-eyebrow { color: var(--color-gold); }

.rd-question {
    max-width: 30ch;
    margin: var(--space-3) auto 0;
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: var(--step-3);
    font-style: italic;
    font-weight: 400;
    line-height: var(--lh-snug);
    text-wrap: balance;
}

.rd .quotable-line { margin-bottom: var(--space-7); }

.rd-cards {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    list-style: none;
}

.rd-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: var(--space-4);
    align-items: start;
    padding: var(--space-5);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-l);
    background: rgba(13, 27, 46, 0.72);
}

@media (min-width: 600px) {
    .rd-card { grid-template-columns: 128px minmax(0, 1fr); gap: var(--space-6); padding: var(--space-6); }
}

.rd-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-s);
    box-shadow: var(--shadow-2);
}

.rd-card h2 {
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: var(--step-2);
    font-weight: 600;
    line-height: var(--lh-tight);
}

.rd-anchor {
    margin-top: var(--space-2);
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-style: italic;
    line-height: var(--lh-snug);
}

.rd-interp {
    margin-top: var(--space-3);
    color: var(--color-text-2);
    font-size: var(--step-0);
    line-height: var(--lh-reading);
}

.rd-theme {
    margin-top: var(--space-4);
    color: var(--color-text-3);
}

@media (max-width: 599px) {
    /* Image beside the name; the text runs the full width under both */
    .rd-card { grid-template-columns: 72px minmax(0, 1fr); }
    .rd-card > div { display: contents; }
    .rd-card img { grid-row: 1 / span 2; }
    .rd-card h2 { align-self: end; }
    .rd-anchor { grid-column: 2; align-self: start; margin-top: 0; }
    .rd-interp,
    .rd-theme { grid-column: 1 / -1; }
}

.rd-summary {
    margin-bottom: var(--space-5);
    padding: var(--space-6) var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-l);
    background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface-1));
}

@media (min-width: 600px) {
    .rd-summary { padding: var(--space-6) var(--space-7); }
}

.rd-section-title {
    margin-bottom: var(--space-3);
    color: var(--color-gold);
}

.rd-summary p {
    color: var(--color-text);
    font-size: var(--step-0);
    line-height: var(--lh-reading);
}

.rd-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-7);
}

@media (max-width: 599px) {
    .rd-actions > * { width: 100%; }
}

.rd-cta {
    margin-top: var(--space-7);
    padding: var(--space-7) var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-l);
    background: var(--glow-hero), var(--color-surface-1);
    text-align: center;
}

.rd-cta h2 {
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: var(--step-3);
    font-weight: 600;
    line-height: var(--lh-tight);
    text-wrap: balance;
}

.rd-cta p {
    max-width: 44ch;
    margin: var(--space-3) auto var(--space-5);
    color: var(--color-text-2);
    font-size: var(--step-0);
    line-height: var(--lh-body);
}

/* Share button after the link is copied */
.share-reading-btn.copied { background: var(--color-success); }

/* ---------- Reading feedback ---------- */
/* Quiet on purpose: it sits under the actions and never competes with them. */

.reading-feedback {
    max-width: 520px;
    margin: var(--space-7) auto var(--space-2);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border-subtle);
    text-align: center;
}

.feedback-prompt,
.feedback-thanks {
    color: var(--color-text-2);
    font-size: var(--step--1);
}

.feedback-prompt { margin-bottom: var(--space-3); }

.feedback-choices,
.feedback-reasons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
}

.feedback-reasons { flex-direction: column; align-items: stretch; }

.feedback-btn,
.feedback-reason,
.feedback-send {
    min-height: 40px;
    padding: var(--space-2) var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: rgba(17, 35, 57, 0.6);
    color: var(--color-text);
    font-size: var(--step--1);
    cursor: pointer;
    transition: background-color var(--dur-2) ease, border-color var(--dur-2) ease, transform var(--dur-1) ease;
}

.feedback-reason {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-m);
    text-align: start;
}

.feedback-btn:hover,
.feedback-reason:hover,
.feedback-send:hover { border-color: var(--color-border-strong); background: var(--color-surface-3); }

.feedback-btn:active,
.feedback-reason:active { transform: scale(0.98); }

.feedback-note {
    display: block;
    width: 100%;
    margin: var(--space-3) 0 var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-m);
    background: rgba(8, 16, 32, 0.5);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--step--1);
    resize: vertical;
}

.feedback-note::placeholder { color: var(--color-text-3); }

.feedback-send { margin-top: var(--space-1); }

/* ---------- Dialog panels ---------- */
/* The <dialog> shell, backdrop and scroll live in site.css (.sd-dialog). */

.modal-content,
.email-modal-content,
.share-modal-content,
.subscription-modal-content,
.past-readings-content {
    position: relative;
    width: 100%;
    padding: var(--space-6) var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-l);
    background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface-1));
    box-shadow: var(--shadow-3);
    color: var(--color-text);
    text-align: center;
}

@media (min-width: 600px) {
    .email-modal-content,
    .share-modal-content { padding: var(--space-7) var(--space-6) var(--space-6); }
    .subscription-modal-content,
    .past-readings-content { padding: var(--space-7); }
}

.email-modal-title,
.share-modal-title,
.past-readings-title,
.subscription-title,
.modal-title {
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: var(--step-3);
    font-weight: 600;
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-display);
    text-wrap: balance;
}

.email-modal-title,
.share-modal-title { margin: 0 var(--space-6) var(--space-2); }

.email-modal-subtitle,
.share-modal-subtitle,
.subscription-subtitle {
    margin-bottom: var(--space-5);
    color: var(--color-text-2);
    font-size: var(--step-0);
    line-height: var(--lh-body);
}

.email-modal-subtitle strong { color: var(--color-text); font-weight: 600; word-break: break-all; }

.modal-centered { text-align: center; }

.modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: rgba(215, 195, 130, 0.08);
    color: var(--color-gold);
}

.modal-icon .icon { width: 26px; height: 26px; }

.modal-action { margin-top: var(--space-5); }

/* Close buttons */
.email-modal-close,
.subscription-modal-close,
.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-text-3);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color var(--dur-2) ease, color var(--dur-2) ease;
}

.email-modal-close,
.subscription-modal-close {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
}

.email-modal-close:hover,
.subscription-modal-close:hover,
.modal-close:hover { background: var(--color-surface-3); color: var(--color-text); }

.email-modal-close .icon,
.subscription-modal-close .icon,
.modal-close .icon { width: 20px; height: 20px; }

/* Forms */
.email-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    text-align: start;
}

.email-input,
.share-link-input {
    width: 100%;
    min-height: 48px;
    padding: 0 var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-m);
    background: rgba(8, 16, 32, 0.6);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 16px; /* no iOS zoom */
    transition: border-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}

.email-input:focus,
.share-link-input:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(215, 195, 130, 0.18);
}

.email-input::placeholder { color: var(--color-text-3); }

.marketing-opt-in {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    color: var(--color-text-2);
    font-size: var(--step--1);
    line-height: 1.45;
    cursor: pointer;
}

.marketing-opt-in input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--gold);
    cursor: pointer;
}

.email-submit-btn,
.copy-link-btn,
.plan-button-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 48px;
    padding: 0 var(--space-6);
    border: 0;
    border-radius: var(--radius-full);
    background: var(--gradient-gold);
    color: var(--color-on-gold);
    font-family: var(--font-body);
    font-size: var(--step-0);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-1);
    transition: background-color var(--dur-2) ease, box-shadow var(--dur-2) ease, transform var(--dur-1) ease;
}

.email-form .email-submit-btn { width: 100%; }

.email-submit-btn:hover:not(:disabled),
.copy-link-btn:hover,
.plan-button-primary:hover:not(:disabled) { background: var(--color-gold-hover); box-shadow: var(--glow-gold); }

.email-submit-btn:active,
.copy-link-btn:active { transform: translateY(1px); }

.email-submit-btn:disabled { opacity: 0.6; cursor: progress; }

.email-privacy {
    margin-top: var(--space-4);
    color: var(--color-text-3);
    font-size: var(--step--1);
    line-height: var(--lh-body);
}

/* The spam hint is read, not fine print: a visitor abandoned their first
   address after 35s waiting for the link. */
.email-spam-hint {
    margin-top: var(--space-2);
    color: var(--color-text-2);
}

/* Share */
.share-link-container {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.copy-link-btn { flex: none; min-width: 96px; padding: 0 var(--space-5); }

.copy-link-btn.copied { background: var(--color-success); }

.share-modal-close {
    min-height: 44px;
    padding: 0 var(--space-6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-text-2);
    font-size: var(--step--1);
    font-weight: 600;
    cursor: pointer;
}

.share-modal-close:hover { border-color: var(--color-border-strong); color: var(--color-text); }

@media (max-width: 479px) {
    .share-link-container { flex-direction: column; }
}

/* Question lists: suggestions dialog and the blank-question picker */
.modal-content { padding: 0; overflow: hidden; text-align: start; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-5) var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
}

.suggestions-grid {
    display: grid;
    gap: var(--space-2);
    max-height: min(60vh, calc(100dvh - 140px));
    padding: var(--space-4) var(--space-5) var(--space-5);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.suggestion-item {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-m);
    background: rgba(8, 16, 32, 0.4);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--step-0);
    line-height: 1.4;
    text-align: start;
    cursor: pointer;
    transition: border-color var(--dur-2) ease, background-color var(--dur-2) ease, color var(--dur-2) ease;
}

.suggestion-item:hover {
    border-color: var(--color-border-strong);
    background: var(--color-surface-3);
    color: var(--color-gold-hover);
}

.reshuffle-container {
    margin-top: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border-subtle);
}

.reshuffle-button,
.blank-picker-shuffle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 40px;
    padding: 0 var(--space-3);
    border: 0;
    border-radius: var(--radius-full);
    background: none;
    color: var(--color-gold);
    font-size: var(--step--1);
    font-weight: 600;
    cursor: pointer;
}

.reshuffle-button { width: 100%; }

.reshuffle-button:hover,
.blank-picker-shuffle:hover { background: rgba(215, 195, 130, 0.08); }

.reshuffle-button .icon,
.blank-picker-shuffle .icon { width: 16px; height: 16px; }

.blank-picker-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: var(--space-4) 0 var(--space-2);
}

.blank-picker-shuffle { margin: 0 auto var(--space-3); }

.blank-picker-general {
    width: 100%;
    min-height: 44px;
    padding: 0 var(--space-4);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-full);
    background: none;
    color: var(--color-gold);
    font-size: var(--step--1);
    font-weight: 600;
    cursor: pointer;
}

.blank-picker-general:hover { border-color: var(--color-gold); background: rgba(215, 195, 130, 0.08); }

/* Paywall */
.subscription-header { margin-bottom: var(--space-6); }

.subscription-title { margin: 0 var(--space-6) var(--space-3); }

.subscription-subtitle { max-width: 46ch; margin: 0 auto; }

.subscription-plans {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    text-align: start;
}

@media (min-width: 640px) {
    .subscription-plans { grid-template-columns: 1fr 1fr; }
}

.plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: var(--space-6) var(--space-5) var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-l);
    background: rgba(8, 16, 32, 0.45);
    cursor: pointer;
    transition: border-color var(--dur-2) ease, transform var(--dur-2) ease;
}

.plan-card:hover { border-color: var(--color-border-strong); }

.plan-card:has(.plan-badge),
.plan-card.selected {
    border-color: var(--color-gold);
    box-shadow: var(--glow-gold);
}

.plan-badge {
    position: absolute;
    top: -12px;
    left: var(--space-5);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--gradient-gold);
    color: var(--color-on-gold);
    font-size: var(--step--2);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.plan-name {
    margin-bottom: var(--space-2);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--step-0);
    font-weight: 600;
}

.plan-price { display: flex; align-items: baseline; gap: var(--space-1); }

.price-amount {
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: var(--step-4);
    font-weight: 600;
    line-height: 1;
}

.price-period { color: var(--color-text-2); font-size: var(--step--1); }

.plan-savings {
    min-height: 1.4em;
    margin: var(--space-2) 0 var(--space-4);
    color: var(--color-success);
    font-size: var(--step--1);
    font-weight: 500;
}

.plan-features {
    display: grid;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
    list-style: none;
}

.plan-features li {
    position: relative;
    padding-left: var(--space-6);
    color: var(--color-text);
    font-size: var(--step--1);
    line-height: 1.45;
}

.plan-features li::before {
    content: '';
    position: absolute;
    top: 0.15em;
    left: 0;
    width: 16px;
    height: 16px;
    background: var(--gold);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.plan-button {
    width: 100%;
    min-height: 48px;
    margin-top: auto;
    padding: 0 var(--space-5);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-gold);
    font-size: var(--step-0);
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--dur-2) ease, border-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}

.plan-button:hover { border-color: var(--color-gold); background: rgba(215, 195, 130, 0.08); }

.plan-button.plan-button-primary {
    border: 0;
    background: var(--gradient-gold);
    color: var(--color-on-gold);
    box-shadow: var(--shadow-1);
}

.plan-button.plan-button-primary:hover:not(:disabled) { background: var(--color-gold-hover); box-shadow: var(--glow-gold); }

.plan-button:disabled { opacity: 0.6; cursor: progress; }

.subscription-footer {
    color: var(--color-text-3);
    font-size: var(--step--1);
}

/* Past readings */
.past-readings-title { margin: 0 var(--space-6) var(--space-5); }

.past-readings-content { text-align: start; }
.past-readings-content .past-readings-title { text-align: center; }

.past-readings-list {
    display: grid;
    gap: var(--space-3);
}

.past-reading-item {
    display: grid;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-4);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-m);
    background: rgba(8, 16, 32, 0.45);
    color: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color var(--dur-2) ease, background-color var(--dur-2) ease;
}

.past-reading-item:hover { border-color: var(--color-border-strong); background: var(--color-surface-3); }

.past-reading-date {
    color: var(--color-text-3);
    font-size: var(--step--2);
    font-variant-numeric: tabular-nums;
}

.past-reading-question {
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-style: italic;
    line-height: var(--lh-snug);
}

.past-reading-cards { display: flex; gap: var(--space-2); margin-top: var(--space-1); }

.past-reading-card-thumb {
    width: 36px;
    height: 54px;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: var(--shadow-1);
}

.no-readings {
    padding: var(--space-6) var(--space-4);
    color: var(--color-text-2);
    text-align: center;
}

.no-readings p { margin-bottom: var(--space-5); }

/* ---------- Account menu ---------- */

.account-menu {
    position: fixed;
    top: calc(var(--header-h) + var(--space-2));
    right: max(var(--space-4), calc((100vw - var(--wrap)) / 2 + var(--gutter)));
    z-index: var(--z-dropdown);
    min-width: 260px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-m);
    background: var(--color-surface-1);
    box-shadow: var(--shadow-3);
    animation: menuIn var(--dur-2) var(--ease-out);
}

@keyframes menuIn {
    from { opacity: 0; transform: translateY(-6px); }
}

.account-menu-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
    background: rgba(8, 16, 32, 0.4);
}

.account-email {
    display: block;
    margin-bottom: 2px;
    color: var(--color-text);
    font-size: var(--step--1);
    word-break: break-all;
}

.account-status {
    display: block;
    color: var(--color-gold);
    font-size: var(--step--2);
    font-weight: 600;
}

.account-menu-items { padding: var(--space-2) 0; }

.account-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    min-height: 44px;
    padding: 0 var(--space-4);
    border: 0;
    background: transparent;
    color: var(--color-text);
    font-family: inherit;
    font-size: var(--step--1);
    text-align: start;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--dur-1) ease;
}

.account-menu-item:hover,
.account-menu-item:focus-visible { background: rgba(215, 195, 130, 0.08); }

.account-menu-item:focus-visible { outline-offset: -2px; }

.account-menu-item .icon { width: 18px; height: 18px; color: var(--color-text-3); }

.account-menu-item.logout {
    margin-top: var(--space-2);
    border-top: 1px solid var(--color-border-subtle);
    color: #F2A7A0;
}

.account-menu-item.logout .icon { color: currentColor; }

@media (max-width: 599px) {
    .account-menu { right: var(--space-3); left: var(--space-3); min-width: 0; }
}

/* ---------- Old question screen (kept until the screen is removed) ---------- */

.question-input-container { margin: var(--space-6) 0; }

.question-input {
    width: 100%;
    min-height: 120px;
    padding: var(--space-4);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-m);
    background: rgba(8, 16, 32, 0.5);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--step-0);
    resize: vertical;
}

.question-hint {
    margin: var(--space-3) var(--space-1) 0;
    padding: var(--space-2) var(--space-4);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-s);
    background: var(--color-purple-soft);
    color: var(--color-text);
    font-size: var(--step--1);
    line-height: var(--lh-body);
}

/* ---------- Motion preference ---------- */

@media (prefers-reduced-motion: reduce) {
    .screen { animation: none; }

    .card-item-positioned .card-back { animation: none; opacity: 1; }
    .card-item.selected .card-back { animation: none; transform: scale(1.04); }
}
