/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6b46c1;
    --secondary-color: #9f7aea;
    --accent-color: #f6ad55;
    --bg-dark: #1a202c;
    --bg-darker: #0f1419;
    --card-bg: #2d3748;
    --text-light: #e2e8f0;
    --text-muted: #a0aec0;
    --border-color: #4a5568;
    --success-color: #48bb78;
    --warning-color: #ed8936;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-light);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated starry background */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.stars::before,
.stars::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    box-shadow:
        100px 100px white,
        200px 200px white,
        300px 50px white,
        400px 300px white,
        500px 150px white,
        600px 250px white,
        700px 100px white,
        800px 200px white,
        900px 50px white,
        1000px 300px white,
        50px 400px white,
        150px 500px white,
        250px 450px white,
        350px 550px white,
        450px 500px white,
        550px 600px white,
        650px 550px white,
        750px 500px white,
        850px 600px white,
        950px 550px white;
    animation: twinkle 3s infinite;
}

.stars::after {
    animation-delay: 1.5s;
}

@keyframes twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    border-bottom: 2px solid var(--border-color);
}

.title {
    font-size: 3rem;
    color: var(--accent-color);
    text-shadow: 0 0 20px rgba(246, 173, 85, 0.5);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

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

/* Spread Selection Grid */
.spread-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.spread-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.spread-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(159, 122, 234, 0.2), transparent);
    transition: left 0.5s ease;
}

.spread-card:hover::before {
    left: 100%;
}

.spread-card:hover {
    transform: translateY(-5px);
    border-color: var(--secondary-color);
    box-shadow: 0 10px 30px rgba(159, 122, 234, 0.3);
}

.spread-card h3 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.spread-card .card-count {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.spread-card p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Question Screen */
.instruction {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-style: italic;
}

#question-input {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: block;
    padding: 1rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#question-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(159, 122, 234, 0.1);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(159, 122, 234, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text-light);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

/* Drawing Animation */
.drawing-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.card-deck {
    position: relative;
    width: 200px;
    height: 300px;
    margin-bottom: 2rem;
}

.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: 3px solid var(--accent-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: shuffle 1s infinite;
}

.card-back::before {
    content: '✦';
    font-size: 4rem;
    color: var(--accent-color);
    animation: spin 2s linear infinite;
}

.card-back:nth-child(2) {
    animation-delay: 0.2s;
    transform: rotate(5deg);
}

.card-back:nth-child(3) {
    animation-delay: 0.4s;
    transform: rotate(-5deg);
}

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

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

.drawing-text {
    font-size: 1.5rem;
    color: var(--accent-color);
    font-style: italic;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Reading Display */
.reading-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.reading-header h2 {
    color: var(--accent-color);
    font-size: 2rem;
    margin-bottom: 1rem;
}

#user-question {
    color: var(--text-muted);
    font-style: italic;
    max-width: 700px;
    margin: 0 auto;
}

/* Cards Layout */
.cards-layout {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}

/* ===== SINGLE CARD LAYOUT ===== */
.cards-layout.single {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 350px;
    margin: 2rem auto;
    min-height: 500px;
}

/* ===== THREE CARD LAYOUT (Past, Present, Future) ===== */
.cards-layout.threeCard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1000px;
    margin: 2rem auto;
}

/* ===== RELATIONSHIP LAYOUT ===== */
/* Layout:
     1       2
        3
        4
        5
*/
.cards-layout.relationship {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    max-width: 1000px;
    margin: 2rem auto;
}

.cards-layout.relationship .card-position:nth-child(1) {
    grid-column: 1 / 3;
    grid-row: 1;
}

.cards-layout.relationship .card-position:nth-child(2) {
    grid-column: 3 / 5;
    grid-row: 1;
}

.cards-layout.relationship .card-position:nth-child(3) {
    grid-column: 2 / 4;
    grid-row: 2;
}

.cards-layout.relationship .card-position:nth-child(4) {
    grid-column: 2 / 4;
    grid-row: 3;
}

.cards-layout.relationship .card-position:nth-child(5) {
    grid-column: 2 / 4;
    grid-row: 4;
}

/* ===== HORSESHOE LAYOUT ===== */
/* Layout (arc shape):
   1       2       3
      4       5
         6
         7
*/
.cards-layout.horseshoe {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(4, auto);
    gap: 1.5rem;
    max-width: 1200px;
    margin: 2rem auto;
}

.cards-layout.horseshoe .card-position:nth-child(1) {
    grid-column: 1 / 3;
    grid-row: 1;
}

.cards-layout.horseshoe .card-position:nth-child(2) {
    grid-column: 3 / 5;
    grid-row: 1;
}

.cards-layout.horseshoe .card-position:nth-child(3) {
    grid-column: 6 / 8;
    grid-row: 1;
}

.cards-layout.horseshoe .card-position:nth-child(4) {
    grid-column: 2 / 4;
    grid-row: 2;
}

.cards-layout.horseshoe .card-position:nth-child(5) {
    grid-column: 5 / 7;
    grid-row: 2;
}

.cards-layout.horseshoe .card-position:nth-child(6) {
    grid-column: 3 / 5;
    grid-row: 3;
}

.cards-layout.horseshoe .card-position:nth-child(7) {
    grid-column: 3 / 5;
    grid-row: 4;
}

/* ===== CELTIC CROSS LAYOUT ===== */
/* Layout:
         4
      5  1  6
         3
         2

   7 (staff)
   8
   9
   10
*/
.cards-layout.celticCross {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(5, auto);
    gap: 1.5rem;
    max-width: 1400px;
    margin: 2rem auto;
}

/* Cross formation (cards 1-6) */
.cards-layout.celticCross .card-position:nth-child(1) {
    grid-column: 4 / 6;
    grid-row: 2;
    z-index: 1;
}

.cards-layout.celticCross .card-position:nth-child(2) {
    grid-column: 4 / 6;
    grid-row: 4;
}

.cards-layout.celticCross .card-position:nth-child(3) {
    grid-column: 4 / 6;
    grid-row: 3;
}

.cards-layout.celticCross .card-position:nth-child(4) {
    grid-column: 4 / 6;
    grid-row: 1;
}

.cards-layout.celticCross .card-position:nth-child(5) {
    grid-column: 2 / 4;
    grid-row: 2;
}

.cards-layout.celticCross .card-position:nth-child(6) {
    grid-column: 6 / 8;
    grid-row: 2;
}

/* Staff formation (cards 7-10) */
.cards-layout.celticCross .card-position:nth-child(7) {
    grid-column: 8 / 10;
    grid-row: 5;
}

.cards-layout.celticCross .card-position:nth-child(8) {
    grid-column: 8 / 10;
    grid-row: 4;
}

.cards-layout.celticCross .card-position:nth-child(9) {
    grid-column: 8 / 10;
    grid-row: 3;
}

.cards-layout.celticCross .card-position:nth-child(10) {
    grid-column: 8 / 10;
    grid-row: 2;
}

/* ===== YEAR AHEAD LAYOUT (12 months in circle) ===== */
.cards-layout.yearAhead {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, auto);
    gap: 1.5rem;
    max-width: 1400px;
    margin: 2rem auto;
}

/* Top row (12, 1, 2, 3) */
.cards-layout.yearAhead .card-position:nth-child(1) {
    grid-column: 4;
    grid-row: 1;
}

.cards-layout.yearAhead .card-position:nth-child(2) {
    grid-column: 5;
    grid-row: 1;
}

.cards-layout.yearAhead .card-position:nth-child(3) {
    grid-column: 6;
    grid-row: 1;
}

/* Right side (4, 5, 6) */
.cards-layout.yearAhead .card-position:nth-child(4) {
    grid-column: 6;
    grid-row: 2;
}

.cards-layout.yearAhead .card-position:nth-child(5) {
    grid-column: 6;
    grid-row: 3;
}

.cards-layout.yearAhead .card-position:nth-child(6) {
    grid-column: 6;
    grid-row: 4;
}

/* Bottom row (7, 8, 9) */
.cards-layout.yearAhead .card-position:nth-child(7) {
    grid-column: 5;
    grid-row: 4;
}

.cards-layout.yearAhead .card-position:nth-child(8) {
    grid-column: 4;
    grid-row: 4;
}

.cards-layout.yearAhead .card-position:nth-child(9) {
    grid-column: 3;
    grid-row: 4;
}

/* Left side (10, 11, 12) */
.cards-layout.yearAhead .card-position:nth-child(10) {
    grid-column: 1;
    grid-row: 3;
}

.cards-layout.yearAhead .card-position:nth-child(11) {
    grid-column: 1;
    grid-row: 2;
}

.cards-layout.yearAhead .card-position:nth-child(12) {
    grid-column: 3;
    grid-row: 1;
}

/* ===== DECISION LAYOUT ===== */
/* Layout:
        1 (current)

   2    6    4
   3         5

        7 (guidance)
*/
.cards-layout.decision {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(4, auto);
    gap: 1.5rem;
    max-width: 1200px;
    margin: 2rem auto;
}

.cards-layout.decision .card-position:nth-child(1) {
    grid-column: 3;
    grid-row: 1;
}

.cards-layout.decision .card-position:nth-child(2) {
    grid-column: 1 / 2;
    grid-row: 2;
}

.cards-layout.decision .card-position:nth-child(3) {
    grid-column: 1 / 2;
    grid-row: 3;
}

.cards-layout.decision .card-position:nth-child(4) {
    grid-column: 5 / 6;
    grid-row: 2;
}

.cards-layout.decision .card-position:nth-child(5) {
    grid-column: 5 / 6;
    grid-row: 3;
}

.cards-layout.decision .card-position:nth-child(6) {
    grid-column: 3;
    grid-row: 2;
}

.cards-layout.decision .card-position:nth-child(7) {
    grid-column: 3;
    grid-row: 4;
}

/* Card Position Container */
.card-position {
    perspective: 1000px;
    cursor: pointer;
    animation: cardAppear 0.5s ease-out backwards;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Card Inner Container for Flip Effect */
.card-inner {
    position: relative;
    width: 100%;
    min-height: 400px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-position:hover .card-inner {
    transform: translateY(-10px);
}

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

/* Reversed cards - only flip the image, not the whole card */
.card-position.reversed.flipped .card-inner {
    transform: rotateY(180deg);
}

/* Card Faces */
.card-front, .card-back-face {
    position: absolute;
    width: 100%;
    min-height: 400px;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
}

.card-back-face {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid var(--accent-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.card-back-design {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(159, 122, 234, 0.1) 10px, rgba(159, 122, 234, 0.1) 20px),
        radial-gradient(circle at center, #2d1b69 0%, #1a1a2e 100%);
    border: 8px double var(--accent-color);
    border-radius: 8px;
    margin: 10px;
    position: relative;
}

.card-back-design::before {
    content: '✦';
    font-size: 8rem;
    color: var(--accent-color);
    text-shadow: 0 0 30px rgba(246, 173, 85, 0.8);
    animation: rotate 4s linear infinite;
}

.card-back-design::after {
    content: '';
    position: absolute;
    width: 60%;
    height: 60%;
    border: 2px solid var(--secondary-color);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

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

/* Card Front */
.card-front {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border: 3px solid #8b7355;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Card with Image */
.card-front.card-with-image {
    background: #1a1a1a;
    padding: 0;
}

.card-front::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 2px solid #c9b896;
    border-radius: 8px;
    pointer-events: none;
    z-index: 1;
}

/* Card Image Container */
.card-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0.5rem 0.5rem;
    background: #ffffff;
    position: relative;
}

.tarot-card-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    display: block;
    transition: transform 0.3s ease;
}

/* Rotate only the image for reversed cards */
.card-position.reversed .tarot-card-image {
    transform: rotate(180deg);
}

/* Card Header */
.card-header {
    padding: 0.75rem 1rem;
    text-align: center;
    background: linear-gradient(to bottom, rgba(107, 70, 193, 0.9), rgba(107, 70, 193, 0.7));
    position: relative;
    z-index: 2;
}

.card-with-image .card-header {
    border-bottom: none;
}

.position-label {
    font-size: 0.75rem;
    color: #f6ad55;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.card-name {
    font-size: 1.4rem;
    color: #2d1b69;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.card-name-label {
    font-size: 1.1rem;
    color: #e2e8f0;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Card Visual Symbol */
.card-visual {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
}

.card-symbol {
    font-size: 5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

/* Suit Colors */
.suit-wands .card-symbol {
    color: #d35400;
}

.suit-cups .card-symbol {
    color: #3498db;
}

.suit-swords .card-symbol {
    color: #7f8c8d;
}

.suit-pentacles .card-symbol {
    color: #f39c12;
}

.suit-major .card-symbol {
    background: linear-gradient(135deg, #6b46c1, #9f7aea, #f6ad55);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card Number/Rank */
.card-rank {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d1b69;
    margin-bottom: 0.5rem;
}

/* Card Footer */
.card-footer {
    padding: 1rem;
    text-align: center;
    background: linear-gradient(to top, rgba(45, 45, 45, 0.95), rgba(26, 26, 26, 0.9));
    position: relative;
    z-index: 2;
}

.card-with-image .card-footer {
    border-top: none;
}

.card-meaning {
    color: #5d4e37;
    line-height: 1.6;
    font-size: 0.9rem;
    font-style: italic;
}

.card-meaning-brief {
    color: #a0aec0;
    line-height: 1.5;
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 0.5rem;
}

/* Pips (number indicators for Minor Arcana) */
.card-pips {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
    max-width: 200px;
}

.card-pips.pips-1 { grid-template-columns: 1fr; }
.card-pips.pips-2 { grid-template-columns: repeat(2, 1fr); }
.card-pips.pips-3 { grid-template-columns: repeat(3, 1fr); }
.card-pips.pips-4 { grid-template-columns: repeat(2, 1fr); }
.card-pips.pips-5 { grid-template-columns: repeat(3, 1fr); }
.card-pips.pips-6 { grid-template-columns: repeat(3, 1fr); }
.card-pips.pips-7 { grid-template-columns: repeat(3, 1fr); }
.card-pips.pips-8 { grid-template-columns: repeat(4, 1fr); }
.card-pips.pips-9 { grid-template-columns: repeat(3, 1fr); }
.card-pips.pips-10 { grid-template-columns: repeat(4, 1fr); }

.pip {
    font-size: 1.5rem;
}

/* Court Cards Indicator */
.court-indicator {
    font-size: 1rem;
    color: #8b7355;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-top: 0.5rem;
}

.orientation-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.orientation-badge.upright {
    background: var(--success-color);
    color: white;
}

.orientation-badge.reversed {
    background: var(--warning-color);
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--accent-color);
}

.modal-body h3 {
    color: var(--accent-color);
    font-size: 2rem;
    margin-bottom: 1rem;
}

#modal-card-position {
    color: var(--secondary-color);
    font-style: italic;
    margin-bottom: 1.5rem;
}

#modal-card-meaning {
    color: var(--text-light);
    line-height: 1.8;
    font-size: 1.1rem;
}

.modal-card-image-container {
    text-align: center;
    margin: 1.5rem 0;
    background: #ffffff;
    padding: 1rem;
    border-radius: 8px;
}

.modal-tarot-image {
    max-width: 100%;
    max-height: 400px;
    height: auto;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

/* Rotate modal image if card is reversed */
.modal-tarot-image.reversed {
    transform: rotate(180deg);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 2px solid var(--border-color);
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .cards-layout.celticCross {
        grid-template-columns: repeat(4, 1fr);
        max-width: 900px;
    }

    .cards-layout.yearAhead {
        grid-template-columns: repeat(4, 1fr);
        max-width: 900px;
    }
}

@media (max-width: 1024px) {
    .cards-layout.celticCross,
    .cards-layout.horseshoe,
    .cards-layout.yearAhead,
    .cards-layout.decision {
        grid-template-columns: repeat(2, 1fr);
    }

    .cards-layout.celticCross .card-position,
    .cards-layout.horseshoe .card-position,
    .cards-layout.yearAhead .card-position,
    .cards-layout.decision .card-position {
        grid-column: auto !important;
        grid-row: auto !important;
    }
}

@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }

    .spread-grid {
        grid-template-columns: 1fr;
    }

    /* Stack all spreads vertically on mobile */
    .cards-layout.threeCard,
    .cards-layout.relationship,
    .cards-layout.horseshoe,
    .cards-layout.celticCross,
    .cards-layout.yearAhead,
    .cards-layout.decision {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        max-width: 400px;
    }

    /* Reset all grid positioning for mobile */
    .cards-layout .card-position {
        grid-column: auto !important;
        grid-row: auto !important;
    }

    .card-inner {
        min-height: 350px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Spread price styling */
.spread-price {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9em;
    margin: 8px 0;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.spread-card:hover .spread-price {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

/* Card images in readings */
.card-image {
    width: 100%;
    max-width: 150px;
    height: auto;
    border-radius: 8px;
    margin: 0.5rem auto;
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.card-display.reversed .card-image {
    transform: rotate(180deg);
}

/* Reading cards container */
#cards-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0;
    max-width: 600px;
    margin: 0 auto;
}

/* Individual reading card */
.reading-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.position-label {
    color: #DAA520;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.card-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
}

.card-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #FFD700;
    text-align: center;
}

.card-meaning {
    color: #E8E8E8;
    line-height: 1.6;
    font-size: 0.95rem;
}

.card-meaning strong {
    color: #DAA520;
}
