.hedomi-tarot {
    --hedomi-tarot-accent: #6c4ab6;
    --hedomi-tarot-bg: #f7f4fb;
    --hedomi-tarot-card-width: 130px;
    max-width: 1080px;
    margin: 32px auto;
    padding: clamp(22px, 4vw, 48px);
    border: 1px solid color-mix(in srgb, var(--hedomi-tarot-accent) 18%, transparent);
    border-radius: 28px;
    background:
        radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--hedomi-tarot-accent) 13%, transparent), transparent 32%),
        var(--hedomi-tarot-bg);
    box-shadow: 0 24px 70px rgba(37, 24, 64, .10);
    color: #241d2d;
    box-sizing: border-box;
    overflow: hidden;
}

.hedomi-tarot *,
.hedomi-tarot *::before,
.hedomi-tarot *::after {
    box-sizing: border-box;
}

.hedomi-tarot__header {
    max-width: 760px;
    margin: 0 auto 26px;
    text-align: center;
}

.hedomi-tarot__title {
    margin: 0 0 12px;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.08;
    letter-spacing: -.025em;
}

.hedomi-tarot__instruction {
    opacity: .78;
    font-size: 17px;
}

.hedomi-tarot__instruction p:last-child {
    margin-bottom: 0;
}

.hedomi-tarot__question-wrap {
    max-width: 720px;
    margin: 0 auto 22px;
}

.hedomi-tarot__question-wrap label {
    display: block;
    margin-bottom: 7px;
    font-weight: 650;
}

.hedomi-tarot__question {
    width: 100%;
    min-height: 74px;
    resize: vertical;
    padding: 13px 15px;
    border: 1px solid rgba(36, 29, 45, .16);
    border-radius: 14px;
    background: rgba(255, 255, 255, .72);
    color: inherit;
    font: inherit;
    box-shadow: none;
}

.hedomi-tarot__question:focus {
    outline: 3px solid color-mix(in srgb, var(--hedomi-tarot-accent) 18%, transparent);
    border-color: var(--hedomi-tarot-accent);
}

.hedomi-tarot__mode-switch {
    display: flex;
    justify-content: center;
    gap: 6px;
    width: fit-content;
    margin: 0 auto 24px;
    padding: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .76);
    box-shadow: inset 0 0 0 1px rgba(36, 29, 45, .08);
}

.hedomi-tarot__mode {
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.hedomi-tarot__mode.is-active {
    background: var(--hedomi-tarot-accent);
    color: #fff;
    box-shadow: 0 7px 18px color-mix(in srgb, var(--hedomi-tarot-accent) 28%, transparent);
}

.hedomi-tarot__selection-status {
    min-height: 25px;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 650;
}

.hedomi-tarot__deck {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
    gap: 10px;
    max-height: 480px;
    overflow: auto;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .54);
    border: 1px solid rgba(36, 29, 45, .08);
    scrollbar-width: thin;
}

.hedomi-tarot__deck.is-shuffling .hedomi-tarot__deck-card {
    animation: hedomi-tarot-shuffle .45s ease both;
}

.hedomi-tarot__deck-card {
    position: relative;
    display: block;
    width: 100%;
    min-width: 44px;
    aspect-ratio: 2 / 3.35;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    transition: transform .18s ease, filter .18s ease;
}

.hedomi-tarot__deck-card:hover {
    transform: translateY(-5px);
    filter: brightness(1.05);
}

.hedomi-tarot__deck-card:focus-visible {
    outline: 3px solid var(--hedomi-tarot-accent);
    outline-offset: 3px;
}

.hedomi-tarot__deck-card.is-selected {
    transform: translateY(-8px) rotate(-1deg);
}

.hedomi-tarot__card-back,
.hedomi-tarot__flip-back {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background-color: #302447;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, .85) 0 2px, transparent 3px),
        linear-gradient(135deg, #33254f, var(--hedomi-tarot-accent));
    background-size: cover, cover;
    background-position: center;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .18), inset 0 0 0 5px rgba(0, 0, 0, .15), 0 8px 16px rgba(30, 20, 45, .18);
}

.hedomi-tarot__selection-number {
    position: absolute;
    top: -7px;
    right: -7px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--hedomi-tarot-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 3px 9px rgba(0, 0, 0, .25);
}

.hedomi-tarot__deck-card.is-selected .hedomi-tarot__selection-number {
    display: flex;
}

.hedomi-tarot__actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.hedomi-tarot__button {
    appearance: none;
    border: 1px solid var(--hedomi-tarot-accent);
    border-radius: 999px;
    padding: 13px 23px;
    background: var(--hedomi-tarot-accent);
    color: #fff;
    font: inherit;
    font-weight: 720;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--hedomi-tarot-accent) 25%, transparent);
    transition: transform .16s ease, opacity .16s ease, box-shadow .16s ease;
}

.hedomi-tarot__button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px color-mix(in srgb, var(--hedomi-tarot-accent) 32%, transparent);
}

.hedomi-tarot__button:disabled {
    opacity: .45;
    cursor: not-allowed;
    box-shadow: none;
}

.hedomi-tarot__button--secondary {
    background: transparent;
    color: var(--hedomi-tarot-accent);
    box-shadow: none;
}

.hedomi-tarot__selection-panel[data-panel="automatic"] {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.hedomi-tarot__automatic-card {
    width: min(180px, 48vw);
    aspect-ratio: 2 / 3.35;
    margin: 20px auto;
    border-radius: 13px;
    animation: hedomi-tarot-float 3.2s ease-in-out infinite;
}

.hedomi-tarot__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 100px;
    font-weight: 650;
}

.hedomi-tarot__loading[hidden] {
    display: none;
}

.hedomi-tarot__spinner {
    width: 30px;
    height: 30px;
    border: 3px solid color-mix(in srgb, var(--hedomi-tarot-accent) 20%, transparent);
    border-top-color: var(--hedomi-tarot-accent);
    border-radius: 50%;
    animation: hedomi-tarot-spin .75s linear infinite;
}

.hedomi-tarot__error {
    margin: 18px 0;
    padding: 13px 15px;
    border-radius: 12px;
    background: #fff0f0;
    color: #9b2424;
    text-align: center;
}

.hedomi-tarot__reading-header {
    margin-bottom: 24px;
    text-align: center;
}

.hedomi-tarot__reading-header h3 {
    margin: 0 0 8px;
    font-size: clamp(24px, 3vw, 38px);
}

.hedomi-tarot__reading-question {
    opacity: .75;
}

.hedomi-tarot__spread-map {
    position: relative;
    min-height: clamp(480px, 70vw, 720px);
    margin: 10px 0 36px;
    border-radius: 24px;
    overflow: hidden;
    background:
        radial-gradient(circle at center, color-mix(in srgb, var(--hedomi-tarot-accent) 10%, transparent), transparent 55%),
        rgba(255, 255, 255, .46);
    border: 1px solid rgba(36, 29, 45, .08);
}

.hedomi-tarot__spread-map::before,
.hedomi-tarot__spread-map::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 56%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%) rotate(45deg);
    border: 1px solid color-mix(in srgb, var(--hedomi-tarot-accent) 13%, transparent);
    border-radius: 22%;
    pointer-events: none;
}

.hedomi-tarot__spread-map::after {
    width: 36%;
    transform: translate(-50%, -50%) rotate(0deg);
    border-radius: 50%;
}

.hedomi-tarot__map-card {
    position: absolute;
    z-index: 2;
    width: var(--hedomi-tarot-card-width);
    transform: translate(-50%, -50%);
    transform-origin: center;
    text-align: center;
}

.hedomi-tarot__flip-card {
    width: 100%;
    aspect-ratio: 2 / 3.35;
    perspective: 1000px;
    transform: rotate(var(--position-rotation));
}

.hedomi-tarot__flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .78s cubic-bezier(.2, .72, .2, 1);
}

.hedomi-tarot__map-card.is-revealed .hedomi-tarot__flip-inner {
    transform: rotateY(180deg);
}

.hedomi-tarot__flip-back,
.hedomi-tarot__flip-front {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 10px;
    backface-visibility: hidden;
}

.hedomi-tarot__flip-front {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotateY(180deg);
    background: #fff;
    border: 4px solid #fff;
    box-shadow: 0 12px 25px rgba(25, 16, 38, .22);
    font-size: 12px;
    font-weight: 700;
}

.hedomi-tarot__flip-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hedomi-tarot__map-label {
    display: inline-block;
    max-width: 150px;
    margin-top: 7px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .90);
    box-shadow: 0 3px 12px rgba(0, 0, 0, .10);
    font-size: 12px;
    font-weight: 720;
}

.hedomi-tarot__interpretations {
    display: grid;
    gap: 18px;
}

.hedomi-tarot__interpretation {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 16px;
    padding: clamp(18px, 3vw, 28px);
    border-radius: 20px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(36, 29, 45, .08);
}

.hedomi-tarot__interpretation-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--hedomi-tarot-accent);
    color: #fff;
    font-weight: 800;
}

.hedomi-tarot__position-name {
    margin: 0 0 2px;
    color: var(--hedomi-tarot-accent);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hedomi-tarot__position-description {
    margin: 0 0 10px;
    opacity: .66;
    font-style: italic;
}

.hedomi-tarot__interpretation h4,
.hedomi-tarot__tab-panel h4 {
    margin: 0 0 10px;
    font-size: 22px;
}

.hedomi-tarot__interpretation h4 span,
.hedomi-tarot__tab-panel h4 span {
    font-size: 14px;
    font-weight: 500;
    opacity: .58;
}

.hedomi-tarot__keywords {
    margin: 0 0 12px;
    color: var(--hedomi-tarot-accent);
    font-size: 14px;
    font-weight: 650;
}

.hedomi-tarot__meaning > :first-child {
    margin-top: 0;
}

.hedomi-tarot__meaning > :last-child {
    margin-bottom: 0;
}

.hedomi-tarot__tabs {
    overflow: hidden;
    border: 1px solid rgba(36, 29, 45, .10);
    border-radius: 20px;
    background: rgba(255, 255, 255, .70);
}

.hedomi-tarot__tab-list {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding: 8px;
    border-bottom: 1px solid rgba(36, 29, 45, .08);
}

.hedomi-tarot__tab {
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    padding: 9px 14px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.hedomi-tarot__tab.is-active {
    background: var(--hedomi-tarot-accent);
    color: #fff;
}

.hedomi-tarot__tab-panel {
    padding: clamp(20px, 4vw, 36px);
}

.hedomi-tarot__actions--results {
    margin-top: 28px;
}

.hedomi-tarot-message {
    padding: 14px 16px;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    background: #fff;
}

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

@keyframes hedomi-tarot-float {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes hedomi-tarot-shuffle {
    0% { transform: translate(0, 0) rotate(0); }
    50% { transform: translate(calc((var(--random, 1)) * 5px), -8px) rotate(4deg); }
    100% { transform: translate(0, 0) rotate(0); }
}

@media (max-width: 720px) {
    .hedomi-tarot {
        padding: 20px 14px 28px;
        border-radius: 18px;
    }

    .hedomi-tarot__deck {
        grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
        gap: 7px;
        max-height: 390px;
        padding: 11px;
    }

    .hedomi-tarot__spread-map {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 14px;
        min-height: auto;
        padding: 24px 14px;
    }

    .hedomi-tarot__spread-map::before,
    .hedomi-tarot__spread-map::after {
        display: none;
    }

    .hedomi-tarot__map-card {
        position: relative;
        left: auto !important;
        top: auto !important;
        width: min(var(--hedomi-tarot-card-width), 38vw);
        margin: 0 auto;
        transform: none;
    }

    .hedomi-tarot__interpretation {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hedomi-tarot *,
    .hedomi-tarot *::before,
    .hedomi-tarot *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}


.hedomi-tarot__ai-consent {
    margin: -6px 0 22px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--hedomi-tarot-accent) 18%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--hedomi-tarot-accent) 5%, #fff);
    font-size: 13px;
    line-height: 1.5;
}

.hedomi-tarot__ai-consent p {
    margin: 0 0 8px;
    opacity: .78;
}

.hedomi-tarot__ai-consent label {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
}

.hedomi-tarot__ai-consent input {
    flex: 0 0 auto;
    margin-top: 3px;
}

.hedomi-tarot__ai-notice {
    margin: 0 0 22px;
    padding: 13px 16px;
    border-radius: 13px;
    background: #fff8df;
    color: #6e5411;
    text-align: center;
}

.hedomi-tarot__ai-block {
    margin-top: 4px;
    padding: 18px;
    border: 1px solid color-mix(in srgb, var(--hedomi-tarot-accent) 16%, transparent);
    border-radius: 15px;
    background: color-mix(in srgb, var(--hedomi-tarot-accent) 4%, #fff);
}

.hedomi-tarot__ai-label {
    margin: 0 0 9px;
    color: var(--hedomi-tarot-accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hedomi-tarot__meaning--ai p:first-child,
.hedomi-tarot__ai-guidance p:first-child,
.hedomi-tarot__ai-summary p:first-child {
    margin-top: 0;
}

.hedomi-tarot__meaning--ai p:last-child,
.hedomi-tarot__ai-guidance p:last-child,
.hedomi-tarot__ai-summary p:last-child {
    margin-bottom: 0;
}

.hedomi-tarot__ai-guidance {
    margin-top: 15px;
    padding-top: 14px;
    border-top: 1px solid color-mix(in srgb, var(--hedomi-tarot-accent) 13%, transparent);
}

.hedomi-tarot__ai-guidance > strong {
    display: block;
    margin-bottom: 6px;
    color: var(--hedomi-tarot-accent);
}

.hedomi-tarot__traditional {
    margin-top: 13px;
    border-top: 1px dashed rgba(36, 29, 45, .14);
    padding-top: 11px;
}

.hedomi-tarot__traditional summary {
    color: var(--hedomi-tarot-accent);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.hedomi-tarot__traditional .hedomi-tarot__meaning {
    margin-top: 12px;
}

.hedomi-tarot__ai-summary {
    margin-top: 28px;
    padding: clamp(22px, 4vw, 38px);
    border: 1px solid color-mix(in srgb, var(--hedomi-tarot-accent) 18%, transparent);
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--hedomi-tarot-accent) 11%, transparent), transparent 42%),
        rgba(255, 255, 255, .78);
}

.hedomi-tarot__ai-summary h3 {
    margin: 0 0 15px;
    color: var(--hedomi-tarot-accent);
    font-size: clamp(23px, 3vw, 34px);
}

.hedomi-tarot__closing-reflection {
    margin-top: 20px;
    padding: 16px 18px;
    border-left: 4px solid var(--hedomi-tarot-accent);
    background: color-mix(in srgb, var(--hedomi-tarot-accent) 5%, #fff);
}

.hedomi-tarot__closing-reflection > strong {
    display: block;
    margin-bottom: 6px;
}

.hedomi-tarot__disclaimer {
    margin: 20px 0 0 !important;
    padding-top: 14px;
    border-top: 1px solid rgba(36, 29, 45, .09);
    font-size: 12px;
    opacity: .64;
}


/* Reading mode badge: makes it obvious whether OpenAI enhanced this result. */
.hedomi-tarot__reading-mode {
    display: inline-flex;
    align-items: center;
    margin: 0 0 14px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    background: rgba(15, 23, 42, .07);
    color: #334155;
}

.hedomi-tarot__reading-mode.is-ai {
    background: color-mix(in srgb, var(--hedomi-tarot-accent, #6c4ab6) 14%, white);
    color: var(--hedomi-tarot-accent, #6c4ab6);
}

.hedomi-tarot__reading-mode.is-fallback {
    background: #fff7ed;
    color: #9a3412;
}
