.table-area {
    position: relative;
    width: 100%;
    min-height: 100dvh;
    background: radial-gradient(circle at top center, #231936 0%, #0d0a14 85%);
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 0;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    padding-bottom: 32px;
}

/* Ekran startowy (Home) */
.home-setup-area {
    justify-content: center;
    padding: 20px 16px;
}

.setup-card {
    width: 100%;
    max-width: 600px;
    background: rgba(20, 15, 32, 0.85);
    border: 1px solid rgba(243, 208, 120, 0.35);
    border-radius: 16px;
    padding: 22px 18px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.setup-header {
    text-align: center;
}

.setup-header h2 {
    color: #f3d078;
    font-size: 1.45rem;
    margin-bottom: 4px;
}

.setup-header p {
    color: #d6c394;
    font-size: 0.88rem;
    margin: 0;
}

.field-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #f3d078;
    margin-top: 4px;
}

.name-input {
    width: 100%;
    background: rgba(22, 17, 34, 0.9);
    color: #f5e9c9;
    border: 1px solid rgba(243, 208, 120, 0.4);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.name-input:focus {
    border-color: #f3d078;
    box-shadow: 0 0 10px rgba(243, 208, 120, 0.2);
}

.session-badge {
    text-align: center;
    font-size: 0.72rem;
    color: rgba(243, 208, 120, 0.45);
}

/* Pasek kontekstu na stronie rozkładu */
.spread-context-bar {
    width: 100%;
    max-width: 720px;
    padding: 12px 16px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 100;
}

.context-user-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.context-user-btn {
    border-color: rgba(243, 208, 120, 0.55);
}

.context-question-box {
    width: 100%;
    max-width: 640px;
    text-align: center;
    font-size: clamp(0.9rem, 2.6vw, 1.02rem);
    font-style: italic;
    line-height: 1.4;
    color: #f5e9c9;
    padding: 4px 12px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.btn-back-link {
    padding: 5px 11px;
    font-size: 0.78rem;
}

.context-summary {
    flex: 1;
    min-width: 200px;
    text-align: right;
    font-size: 0.84rem;
    color: #e4d4a7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-user {
    font-weight: 700;
    color: #f3d078;
    margin-right: 4px;
}

.context-question {
    font-style: italic;
}

/* Sekcja pytania i chipów */
.question-section {
    width: 100%;
    max-width: 640px;
    padding: 4px 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.question-input {
    width: 100%;
    background: rgba(22, 17, 34, 0.9);
    color: #f5e9c9;
    border: 1px solid rgba(243, 208, 120, 0.4);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.92rem;
    line-height: 1.35;
    resize: vertical;
    min-height: 3.4em;
    max-height: calc(5 * 1.35em + 18px);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.question-input::placeholder,
.name-input::placeholder {
    color: rgba(243, 208, 120, 0.45);
}

.question-input:focus {
    border-color: #f3d078;
    box-shadow: 0 0 10px rgba(243, 208, 120, 0.2);
}

.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 4px;
}

.chip {
    background: rgba(42, 31, 61, 0.75);
    color: #e4d4a7;
    border: 1px solid rgba(243, 208, 120, 0.3);
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
    text-align: left;
}

.chip:hover:not(:disabled) {
    background: rgba(68, 50, 99, 0.9);
    border-color: #f3d078;
}

.chip.active {
    background: #3d2c5c;
    color: #f3d078;
    border-color: #f3d078;
}

.chip:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Przyciski */
.controls {
    margin-top: 10px;
    z-index: 100;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 12px;
}

.btn-tarot {
    padding: 7px 14px;
    font-size: clamp(0.78rem, 2.4vw, 0.9rem);
    background: #2a1f3d;
    color: #f3d078;
    border: 1px solid #f3d078;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s, box-shadow 0.2s;
}

.btn-primary-action {
    background: linear-gradient(135deg, #4b3470 0%, #2f2049 100%);
    padding: 10px 22px;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(243, 208, 120, 0.2);
}

.btn-tarot:hover:not(:disabled) {
    background: #382952;
}

.btn-tarot:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-tarot:active:not(:disabled) {
    transform: scale(0.95);
}

.status-hint {
    margin-top: 8px;
    font-size: 0.78rem;
    color: rgba(243, 208, 120, 0.75);
    text-align: center;
    padding: 0 12px;
    min-height: 1.2em;
    z-index: 90;
}

/* Responsywny rozmiar karty zachowujący dokładne proporcje 414x788 */
.deck-origin {
    position: relative;
    margin-top: 26px;
    height: clamp(125px, 28vh, 210px);
    aspect-ratio: 414 / 788;
    max-width: 24vw;
    perspective: 1000px;
    transition: margin-bottom 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.deck-origin.compact-spread {
    margin-bottom: 18px;
}

.deck-origin.dragging-arc .card-slot:not(.dealt) {
    transition: none;
    cursor: grabbing;
}

/* Kontener pojedynczej karty odpowiadający za ruch po stole */
.card-slot {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.55s ease-out,
        filter 0.2s;
    will-change: transform, opacity;
    cursor: pointer;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.card-slot.vanished {
    opacity: 0;
    pointer-events: none;
}

.card-slot.selectable:hover .card-face,
.card-slot.selectable.touched .card-face {
    border-color: #ffe396;
    box-shadow: 0 0 16px rgba(243, 208, 120, 0.7);
}

.card-slot.hint-pulse .card-face {
    animation: cardHintGlow 1.2s ease-in-out infinite alternate;
}

/* Wnętrze karty odpowiadające za obrót Rewers -> Awers */
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: transform;
}

.card-inner.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.65);
    overflow: hidden;
    border: 1px solid rgba(243, 208, 120, 0.35);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card-back {
    background-color: #161122;
}

.card-front {
    transform: rotateY(180deg);
    background-color: #0e0b16;
}

.card-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.ai-ready-bar {
    margin-top: auto;
    padding-top: 16px;
    z-index: 100;
}

/* Dymek z animacją dotyku po odkryciu karty */
.hold-hint-toast {
    position: absolute;
    top: 255%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(34, 24, 54, 0.95);
    color: #ffe699;
    border: 1px solid #f3d078;
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.75), 0 0 12px rgba(243, 208, 120, 0.35);
    pointer-events: none;
    animation: toastPopIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.touch-ripple {
    display: inline-block;
    font-size: 1rem;
    animation: touchPressAnim 1.1s ease-in-out infinite;
}

/* Pełnoekranowy podgląd karty podczas przytrzymania */
.card-inspect-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(10, 7, 18, 0.86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
    animation: inspectFadeIn 0.18s ease-out;
}

.card-inspect-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 440px;
    width: 100%;
    gap: 14px;
    animation: inspectScaleUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-inspect-image {
    height: min(54dvh, 460px);
    aspect-ratio: 414 / 788;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #f3d078;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85), 0 0 24px rgba(243, 208, 120, 0.35);
}

.card-inspect-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-inspect-details {
    background: rgba(26, 20, 41, 0.95);
    border: 1px solid rgba(243, 208, 120, 0.45);
    border-radius: 12px;
    padding: 12px 16px;
    text-align: center;
    width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.card-inspect-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #f3d078;
    margin-bottom: 4px;
}

.card-inspect-title span {
    font-weight: 400;
    font-size: 0.92rem;
    color: #d6c394;
}

.card-inspect-symbols {
    font-size: 0.8rem;
    color: #b79ced;
    margin-bottom: 8px;
    font-weight: 500;
}

.card-inspect-meaning {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #f5e9c9;
}

@keyframes inspectFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes inspectScaleUp {
    from {
        transform: scale(0.88);
    }

    to {
        transform: scale(1);
    }
}

@keyframes cardHintGlow {
    from {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.65);
        border-color: rgba(243, 208, 120, 0.35);
    }

    to {
        box-shadow: 0 0 18px rgba(243, 208, 120, 0.75);
        border-color: #ffe699;
    }
}

@keyframes toastPopIn {
    from {
        opacity: 0;
        transform: translate(-50%, 10px) scale(0.92);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

@keyframes touchPressAnim {

    0%,
    100% {
        transform: scale(1) translateY(0);
    }

    50% {
        transform: scale(0.82) translateY(2px);
    }
}

/* Panel interpretacji AI */
.tarot-reading-panel {
    width: 100%;
    max-width: 720px;
    margin: 22px auto 8px;
    padding: 18px 16px;
    background: linear-gradient(180deg, rgba(28, 20, 44, 0.94) 0%, rgba(16, 12, 26, 0.97) 100%);
    border: 1px solid rgba(243, 208, 120, 0.45);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7), 0 0 20px rgba(243, 208, 120, 0.12);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 14px;
    -webkit-user-select: text;
    user-select: text;
    animation: inspectFadeIn 0.35s ease-out;
}

.reading-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    border-bottom: 1px solid rgba(243, 208, 120, 0.2);
    padding-bottom: 12px;
}

.reading-sparkle {
    color: #f3d078;
    font-size: 1.1rem;
}

.reading-greeting {
    font-size: 1.02rem;
    font-weight: 600;
    color: #ffe699;
    line-height: 1.4;
}

.ai-quota-badge {
    font-size: 0.72rem;
    color: #b79ced;
    background: rgba(58, 42, 89, 0.55);
    border: 1px solid rgba(183, 156, 237, 0.3);
    border-radius: 12px;
    padding: 2px 10px;
}

.reading-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reading-card-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(36, 26, 56, 0.65);
    border: 1px solid rgba(243, 208, 120, 0.22);
    border-radius: 12px;
    padding: 10px 12px;
}

.reading-card-thumb {
    width: 48px;
    aspect-ratio: 414 / 788;
    border-radius: 5px;
    border: 1px solid rgba(243, 208, 120, 0.5);
    object-fit: cover;
    flex-shrink: 0;
}

.reading-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reading-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.reading-pos-badge {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(243, 208, 120, 0.16);
    color: #f3d078;
    border: 1px solid rgba(243, 208, 120, 0.35);
    border-radius: 6px;
    padding: 1px 7px;
    font-weight: 700;
}

.reading-card-name {
    font-size: 0.96rem;
    font-weight: 700;
    color: #fff3d1;
}

.reading-card-text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.48;
    color: #e8dec5;
}

.reading-synthesis {
    background: linear-gradient(135deg, rgba(64, 45, 97, 0.55) 0%, rgba(38, 26, 61, 0.75) 100%);
    border: 1px solid rgba(243, 208, 120, 0.45);
    border-radius: 12px;
    padding: 12px 14px;
}

.reading-synthesis-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: #f3d078;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.reading-synthesis p {
    margin: 0;
    font-size: 0.91rem;
    line-height: 1.52;
    color: #fdf6e2;
}

.ai-result-box.ai-error {
    max-width: 640px;
    margin: 14px auto 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(92, 24, 38, 0.85);
    border: 1px solid #f28b9c;
    color: #ffd6dd;
    font-size: 0.86rem;
    text-align: center;
    z-index: 100;
}

.reading-followup-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(243, 208, 120, 0.2);
}

.followup-suggestions-block {
    width: 100%;
    text-align: center;
}

/* Okno modalne nowego / zmienionego pytania */
.tarot-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 950;
    background: rgba(10, 7, 18, 0.82);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: inspectFadeIn 0.2s ease-out;
}

.tarot-modal-card {
    width: 100%;
    max-width: 560px;
    background: linear-gradient(180deg, #221836 0%, #130e20 100%);
    border: 1px solid rgba(243, 208, 120, 0.5);
    border-radius: 16px;
    padding: 20px 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 24px rgba(243, 208, 120, 0.18);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: inspectScaleUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.modal-header h3 {
    color: #f3d078;
    font-size: 1.18rem;
    margin: 0 0 4px;
}

.modal-header p {
    color: #d6c394;
    font-size: 0.84rem;
    margin: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.label-optional {
    font-weight: 400;
    font-size: 0.75rem;
    color: rgba(243, 208, 120, 0.55);
}

.zodiac-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 6px;
    margin-bottom: 4px;
}

.zodiac-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(34, 25, 51, 0.8);
    color: #e4d4a7;
    border: 1px solid rgba(243, 208, 120, 0.28);
    border-radius: 10px;
    padding: 5px 9px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.zodiac-chip:hover {
    background: rgba(58, 43, 86, 0.9);
    border-color: #f3d078;
}

.zodiac-chip.active {
    background: linear-gradient(135deg, #4b3470 0%, #2f2049 100%);
    color: #ffe699;
    border-color: #f3d078;
    box-shadow: 0 0 10px rgba(243, 208, 120, 0.25);
}

.zodiac-symbol {
    font-size: 0.98rem;
    color: #f3d078;
    line-height: 1;
}

.zodiac-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}