* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', serif;
    background: #000 url('Hubble_HH80_new_4Filters_V7_FINALcrop.jpg') center center / cover no-repeat fixed;
    min-height: 100vh;
    color: #e8e8e8;
    position: relative;
    overflow-x: hidden;
}

/* Dark overlay for readability */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 0;
}

header, main {
    position: relative;
    z-index: 1;
}

header {
    position: relative;
    text-align: center;
    padding: 2rem 1rem;
    border-bottom: 1px solid rgba(224, 86, 160, 0.3);
    background: rgba(0, 0, 0, 0.6);
}

header .settings-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

h1 {
    font-family: 'Cinzel Decorative', Georgia, serif;
    font-size: 3rem;
    color: #e056a0;
    text-shadow: 0 0 20px rgba(224, 86, 160, 0.5);
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.tagline {
    font-style: italic;
    color: #c0a0c0;
    font-size: 1.1rem;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.spread-selection {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.spread-btn {
    background: linear-gradient(145deg, #2a1a2e, #1a0a1a);
    border: 2px solid #e056a0;
    color: #e056a0;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.spread-btn:hover {
    background: linear-gradient(145deg, #3a2a3e, #2a1a2e);
    box-shadow: 0 0 20px rgba(224, 86, 160, 0.4);
    transform: translateY(-2px);
}

.spread-btn:active {
    transform: translateY(0);
}

.spread-btn.selected {
    background: #e056a0;
    color: #0d050d;
    box-shadow: 0 0 20px rgba(224, 86, 160, 0.4);
}

/* Draw button */
.draw-btn {
    display: block;
    margin: 0 auto 2rem;
    background: linear-gradient(145deg, #2a1a2e, #1a0a1a);
    border: 2px solid #e056a0;
    color: #e056a0;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.draw-btn:hover {
    background: #e056a0;
    color: #0d050d;
    box-shadow: 0 0 25px rgba(224, 86, 160, 0.5);
    transform: scale(1.05);
}

.draw-btn.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 3rem;
}

.loading.hidden {
    display: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(224, 86, 160, 0.3);
    border-top-color: #e056a0;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

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

.card-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem;
}

/* One Card Layout */
.card-display.one-card {
    justify-content: center;
}

/* Three Card Layout */
.card-display.three-card {
    justify-content: center;
}

/* Celtic Cross Layout */
.card-display.celtic-cross {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr 1fr;
    grid-template-rows: repeat(4, auto);
    gap: 1rem;
    max-width: 900px;
    margin: 0 auto;
}

/* Card Styles */
.tarot-card {
    width: 180px;
    height: 280px;
    perspective: 1000px;
    cursor: pointer;
}

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

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

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
}

.card-back {
    background: linear-gradient(145deg, #2a1a2e, #1a0a1a);
    border: 3px solid #e056a0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.card-back-position {
    color: #e056a0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 0.5rem;
}

.card-back-design {
    width: 100%;
    flex: 1;
    border: 2px solid rgba(224, 86, 160, 0.5);
    border-radius: 8px;
    background:
        linear-gradient(45deg, transparent 48%, rgba(224, 86, 160, 0.3) 49%, rgba(224, 86, 160, 0.3) 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, rgba(224, 86, 160, 0.3) 49%, rgba(224, 86, 160, 0.3) 51%, transparent 52%);
    background-size: 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-back-symbol {
    font-size: 3rem;
    color: #e056a0;
    text-shadow: 0 0 10px rgba(224, 86, 160, 0.5);
}

.card-front {
    background: linear-gradient(145deg, #1a0a1a, #0d050d);
    border: 3px solid #e056a0;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.card-position {
    text-align: center;
    color: #e056a0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(224, 86, 160, 0.3);
}

/* Settings button */
.settings-btn {
    background: transparent;
    border: 2px solid rgba(224, 86, 160, 0.5);
    color: #e056a0;
    padding: 0.75rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    border-color: #e056a0;
    box-shadow: 0 0 15px rgba(224, 86, 160, 0.4);
    transform: translateY(-2px);
}

.settings-btn svg {
    transition: transform 0.3s ease;
}

.settings-btn:hover svg {
    transform: rotate(45deg);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(145deg, #1a0a1a, #0d050d);
    border: 2px solid #e056a0;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(224, 86, 160, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(224, 86, 160, 0.3);
}

.modal-header h2 {
    color: #e056a0;
    font-size: 1.25rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #e056a0;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: transform 0.2s ease;
}

.modal-close:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 1.5rem;
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    color: #c0a0c0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.setting-row label {
    color: #e8e8e8;
    font-size: 0.85rem;
    min-width: 80px;
}

.setting-row input,
.setting-row select {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(224, 86, 160, 0.5);
    color: #e8e8e8;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.setting-row select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e056a0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

.setting-row select option {
    background: #1a0a1a;
    color: #e8e8e8;
}

.setting-row input:focus,
.setting-row select:focus {
    border-color: #e056a0;
    box-shadow: 0 0 8px rgba(224, 86, 160, 0.3);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(224, 86, 160, 0.3);
}

.btn-reset, .btn-save {
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset {
    background: transparent;
    border: 1px solid rgba(224, 86, 160, 0.5);
    color: #c0a0c0;
}

.btn-reset:hover {
    border-color: #e056a0;
    color: #e056a0;
}

.btn-save {
    background: #e056a0;
    border: none;
    color: #0d050d;
    font-weight: bold;
}

.btn-save:hover {
    background: #f066b0;
    box-shadow: 0 0 15px rgba(224, 86, 160, 0.5);
}

.card-title {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1rem;
    line-height: 1.4;
    color: #e8e8e8;
    padding: 0.5rem;
    overflow: hidden;
}

.card-link {
    display: block;
    text-align: center;
    color: #e056a0;
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.5rem;
    margin-top: auto;
    border-top: 1px solid rgba(224, 86, 160, 0.3);
    transition: all 0.3s ease;
}

.card-link:hover {
    background: rgba(224, 86, 160, 0.1);
    text-shadow: 0 0 10px rgba(224, 86, 160, 0.5);
}

/* Celtic Cross specific positioning */
.celtic-cross .tarot-card[data-position="1"],
.celtic-cross .tarot-card[data-position="2"] {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
}

.celtic-cross .tarot-card[data-position="1"] {
    transform: translateY(-20px);
    z-index: 1;
}

.celtic-cross .tarot-card[data-position="2"] {
    transform: rotate(90deg) translateY(20px);
    z-index: 2;
}

.celtic-cross .tarot-card[data-position="1"]:hover,
.celtic-cross .tarot-card[data-position="1"].revealed:hover {
    z-index: 3;
}

.celtic-cross .tarot-card[data-position="3"] {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
}

.celtic-cross .tarot-card[data-position="4"] {
    grid-column: 2;
    grid-row: 3;
    justify-self: center;
}

.celtic-cross .tarot-card[data-position="5"] {
    grid-column: 1;
    grid-row: 2;
    transform: translateX(-20px);
}

.celtic-cross .tarot-card[data-position="6"] {
    grid-column: 3;
    grid-row: 2;
}

.celtic-cross .tarot-card[data-position="7"] {
    grid-column: 4;
    grid-row: 4;
}

.celtic-cross .tarot-card[data-position="8"] {
    grid-column: 4;
    grid-row: 3;
}

.celtic-cross .tarot-card[data-position="9"] {
    grid-column: 4;
    grid-row: 2;
}

.celtic-cross .tarot-card[data-position="10"] {
    grid-column: 4;
    grid-row: 1;
}

/* Article viewer */
.article-viewer {
    margin-top: 2rem;
    border: 2px solid #e056a0;
    border-radius: 12px;
    overflow: hidden;
    background: #0d050d;
}

.article-viewer.hidden {
    display: none;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(145deg, #2a1a2e, #1a0a1a);
    border-bottom: 1px solid rgba(224, 86, 160, 0.3);
}

.article-title {
    color: #e056a0;
    font-size: 1rem;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 1rem;
}

.article-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.article-external-link {
    color: #c0a0c0;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
}

.article-external-link:hover {
    color: #e056a0;
}

.article-close {
    background: none;
    border: none;
    color: #e056a0;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: transform 0.2s ease;
}

.article-close:hover {
    transform: scale(1.2);
}

.article-iframe {
    width: 100%;
    height: 70vh;
    border: none;
    background: #fff;
}

/* Error state */
.error-message {
    text-align: center;
    padding: 2rem;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
    margin: 2rem auto;
    max-width: 500px;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #c0a0c0;
    font-style: italic;
    border-top: 1px solid rgba(224, 86, 160, 0.2);
    border-bottom: 1px solid rgba(224, 86, 160, 0.2);
    margin-top: 2rem;
    background: rgba(0, 0, 0, 0.6);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .spread-btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .tarot-card {
        width: 150px;
        height: 230px;
    }

    .card-title {
        font-size: 0.9rem;
    }

    .celtic-cross {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .celtic-cross .tarot-card {
        width: 80px;
        height: 120px;
    }

    .celtic-cross .card-position,
    .celtic-cross .card-back-position {
        font-size: 0.45rem;
        padding: 0;
        margin-bottom: 0.2rem;
        padding-bottom: 0.2rem;
    }

    .celtic-cross .card-back {
        padding: 0.4rem;
    }

    .celtic-cross .card-front {
        padding: 0.4rem;
    }

    .celtic-cross .card-title {
        font-size: 0.6rem;
    }

    .celtic-cross .card-link {
        font-size: 0.5rem;
    }
}

@media (max-width: 480px) {
    .celtic-cross .tarot-card {
        width: 70px;
        height: 100px;
    }
}
