* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --purple: #A855F7;
    --purple-dark: #7C3AED;
    --teal: #14B8A6;
    --teal-dark: #0D9488;
    --bg-dark: #030712;
    --bg-card: #111827;
    --text-light: #F3F4F6;
    --text-muted: #9CA3AF;
}

/* Utility classes */
.text-purple { color: var(--purple); }
.text-teal { color: var(--teal); }

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    min-height: 100dvh;
}

/* Screen container */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 15px;
    text-align: center;
}

.screen.active {
    display: flex;
}

/* Spiral screen - tighter spacing */
#screen-spiral {
    padding-top: 10px;
    justify-content: flex-start;
    padding-top: 25px;
}

/* Results screen needs to scroll */
#screen-complete {
    justify-content: flex-start;
    padding-top: 20px;
    overflow-y: auto;
}

/* Category screen - tighter to top */
#screen-categories {
    justify-content: flex-start;
    padding-top: 8px;
}

#screen-categories .instruction {
    margin-bottom: 0;
}

#screen-categories .category-hint {
    margin-top: 2px;
}

/* Logo - consistent sizing */
.logo-img {
    max-width: 480px;
    width: 96%;
    height: auto;
    margin-bottom: 5px;
}

/* Spiral container - compact */
.spiral-container {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 10px auto 5px auto;
}

.spiral-svg {
    width: 100%;
    height: 100%;
    /* Animation handled by JS for breathing effect */
}

.spiral-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple) 0%, var(--teal) 100%);
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.6), 0 0 30px rgba(20, 184, 166, 0.6);
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
}

/* Timer */
.timer {
    font-size: 3rem;
    font-weight: 200;
    color: var(--purple);
    margin: 25px 0 10px 0;
    font-variant-numeric: tabular-nums;
    transition: text-shadow 0.3s ease;
}

.timer.pulse {
    text-shadow: 0 0 20px var(--purple), 0 0 40px var(--purple);
}

.instruction {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 300px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.instruction.highlight {
    color: var(--teal);
}

/* Glowing instruction text */
.instruction.glow {
    color: var(--purple);
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5), 0 0 20px rgba(168, 85, 247, 0.3);
    animation: textGlow 2s ease-in-out infinite;
}

@keyframes textGlow {
    0%, 100% { text-shadow: 0 0 10px rgba(168, 85, 247, 0.5), 0 0 20px rgba(168, 85, 247, 0.3); }
    50% { text-shadow: 0 0 15px rgba(168, 85, 247, 0.7), 0 0 30px rgba(168, 85, 247, 0.5), 0 0 40px rgba(20, 184, 166, 0.3); }
}

/* Large glowing title */
.title-glow {
    font-size: 1.1rem;
    color: var(--text-light);
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.6), 0 0 30px rgba(168, 85, 247, 0.4);
    animation: titleGlow 2.5s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 15px rgba(168, 85, 247, 0.6), 0 0 30px rgba(168, 85, 247, 0.4); }
    50% { text-shadow: 0 0 20px rgba(168, 85, 247, 0.8), 0 0 40px rgba(168, 85, 247, 0.6), 0 0 50px rgba(20, 184, 166, 0.4); }
}

/* Code input */
.code-input-container {
    margin: 30px 0 20px 0;
}

.code-input {
    width: 140px;
    font-size: 2.5rem;
    text-align: center;
    background: transparent;
    border: none;
    border-bottom: 3px solid var(--purple);
    color: var(--text-light);
    letter-spacing: 0.5em;
    padding: 10px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

.code-input:focus {
    border-color: var(--teal);
}

.code-input::placeholder {
    color: var(--text-muted);
    letter-spacing: 0.3em;
}

/* Share button on home page - hidden for now */
.share-home-btn {
    display: none;
    margin: 25px auto 0 auto;
    background: transparent;
    border: 2px solid var(--teal);
    color: var(--teal);
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 0 10px rgba(20, 184, 166, 0.5);
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.3);
    animation: tealGlow 2s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .share-home-btn:hover {
        background: var(--teal);
        color: var(--bg-dark);
        box-shadow: 0 0 25px rgba(20, 184, 166, 0.6);
    }
}

.share-home-btn:active,
.share-home-btn.tapped {
    transform: scale(0.97);
    background: var(--teal);
    color: var(--bg-dark);
    box-shadow: 0 0 25px rgba(20, 184, 166, 0.6);
}

.share-home-btn:focus {
    outline: none;
    background: transparent;
    color: var(--teal);
}

@keyframes tealGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(20, 184, 166, 0.3); }
    50% { box-shadow: 0 0 25px rgba(20, 184, 166, 0.5); }
}

/* Category selection */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 320px;
    margin: 10px auto;
}

.category-btn {
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 12px 8px;
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .category-btn:hover {
        border-color: var(--purple);
        transform: translateY(-2px);
    }
}

.category-btn.selected {
    border-color: var(--teal) !important;
    background: rgba(20, 184, 166, 0.2);
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.3);
}

.category-btn.primary {
    border-color: var(--purple) !important;
    background: rgba(168, 85, 247, 0.2);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

.category-btn .icon {
    font-size: 1.3rem;
}

.category-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.category-general {
    grid-column: span 2;
}

.category-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 8px 0;
}

/* Glowing hint text */
.category-hint.glow {
    color: var(--purple);
    text-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
    animation: textGlow 2s ease-in-out infinite;
}

.category-status {
    color: var(--text-light);
    font-size: 0.9rem;
    min-height: 24px;
    margin: 5px 0;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 14px 35px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--purple);
}

.btn-teal {
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
}

/* Deck animation */
.deck-container {
    position: relative;
    width: 200px;
    height: 300px;
    margin: 20px auto;
    perspective: 1000px;
}

#deckContainer {
    cursor: pointer;
}

.deck-card {
    position: absolute;
    width: 120px;
    height: 180px;
    background: url('cards/CardBacks.png') center/cover;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: all 0.3s;
}

.deck-shuffling .deck-card {
    animation: shuffle 0.5s ease-in-out infinite;
}

@keyframes shuffle {
    0%, 100% { transform: translateX(0) translateY(0) rotate(0deg); }
    25% { transform: translateX(-20px) translateY(-10px) rotate(-5deg); }
    75% { transform: translateX(20px) translateY(-10px) rotate(5deg); }
}

/* Deck piles for cutting */
.piles-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px auto;
}

.pile {
    width: 80px;
    height: 120px;
    background: url('cards/CardBacks.png') center/cover;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.pile::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    border: 3px solid transparent;
    transition: border-color 0.3s;
}

.pile:hover::before {
    border-color: var(--purple);
}

.pile.selected::before {
    border-color: var(--teal);
}

.pile-number {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--teal);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
}

.pile.selected .pile-number {
    opacity: 1;
}

/* Pyramid spread layout - CENTERED */
.spread-container {
    position: relative;
    width: 280px;
    height: 415px;
    margin: 10px auto;
}

#spreadInstruction {
    margin-top: 5px;
}

#completedSpread {
    margin-bottom: 10px;
}

.spread-card {
    position: absolute;
    width: 55px;
    height: 82px;
    background: url('cards/CardBacks.png') center/cover;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    cursor: pointer;
    transition: all 0.5s;
    transform-style: preserve-3d;
}

.spread-card.placing {
    animation: placeCard 0.5s ease-out forwards;
}

@keyframes placeCard {
    from { 
        opacity: 0;
        transform: translateY(-100px) rotate(10deg);
    }
    to { 
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
}

/* Card glow - stays in position */
.spread-card.next {
    box-shadow: 0 0 20px var(--purple), 0 0 30px var(--teal);
    animation: cardPulse 1.5s ease-in-out infinite;
}

@keyframes cardPulse {
    0%, 100% { 
        box-shadow: 0 0 15px var(--purple), 0 0 25px rgba(20, 184, 166, 0.5);
    }
    50% { 
        box-shadow: 0 0 25px var(--purple), 0 0 40px var(--teal), 0 0 50px rgba(168, 85, 247, 0.3);
    }
}

.spread-card.revealed {
    cursor: pointer;
}

.spread-card.revealed .card-front {
    transform: rotateY(0deg);
}

.spread-card.revealed .card-back {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 5px;
    transition: transform 0.6s;
}

.card-back {
    background: url('cards/CardBacks.png') center/cover;
}

.card-front {
    transform: rotateY(180deg);
    background-size: cover;
    background-position: center;
}

/* Position labels - only visible on results */
.position-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    font-size: 0.55rem;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

#screen-complete .position-label {
    opacity: 1;
}

/* Pyramid card positions - CENTERED properly */
/* Row 1: Subject */
.spread-card[data-position="1"] { 
    left: 50%; 
    top: 0; 
    margin-left: -27.5px; /* half of card width */
}
/* Row 2: Present, Near Future */
.spread-card[data-position="2"] { 
    left: 50%; 
    top: 110px; 
    margin-left: -77.5px; /* offset left */
}
.spread-card[data-position="3"] { 
    left: 50%; 
    top: 110px; 
    margin-left: 22.5px; /* offset right */
}
/* Row 3: Do, Far Future, Don't */
.spread-card[data-position="5"] { 
    left: 50%; 
    top: 220px; 
    margin-left: -127.5px;
}
.spread-card[data-position="4"] { 
    left: 50%; 
    top: 220px; 
    margin-left: -27.5px;
}
.spread-card[data-position="6"] { 
    left: 50%; 
    top: 220px; 
    margin-left: 72.5px;
}
/* Row 4: Outcome */
.spread-card[data-position="7"] { 
    left: 50%; 
    top: 330px; 
    margin-left: -27.5px;
}

/* Card detail modal */
.card-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 100;
    padding: 20px;
    overflow-y: auto;
}

.card-modal.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-card-image {
    width: 150px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 0 40px rgba(168, 85, 247, 0.5);
    margin: 20px 0;
}

.modal-position {
    color: var(--teal);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.modal-card-name {
    font-size: 1.5rem;
    margin: 10px 0;
    color: var(--text-light);
}

.modal-major-badge {
    background: linear-gradient(135deg, var(--purple) 0%, var(--teal) 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 15px;
}

.modal-interpretation {
    max-width: 400px;
    line-height: 1.8;
    color: var(--text-light);
    font-size: 1rem;
    text-align: left;
    padding: 0 10px;
}

.modal-keywords {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 20px;
    font-style: italic;
}

.modal-close {
    background: var(--bg-card);
    border: 2px solid var(--purple);
    color: var(--text-light);
    padding: 12px 40px;
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 30px;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--purple);
}

/* Synthesis section */
.synthesis-section {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    margin: 30px auto 20px auto;
    max-width: 400px;
}

.synthesis-title {
    color: var(--teal);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 15px;
}

.synthesis-text {
    line-height: 1.8;
    color: var(--text-light);
}

/* Full Reading section */
.full-reading-section {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border: 2px solid var(--teal);
    border-radius: 15px;
    padding: 25px;
    margin: 20px auto;
    max-width: 500px;
}

.full-reading-title {
    color: var(--teal);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 10px rgba(20, 184, 166, 0.5);
}

.full-reading-text {
    line-height: 1.6;
    color: var(--text-light);
    font-size: 0.95rem;
    text-align: left;
}

.full-reading-text p {
    margin: 0 0 12px 0;
}

.full-reading-text p:last-child {
    margin-bottom: 0;
}

.reading-header {
    color: var(--teal);
    display: block;
    margin-bottom: 5px;
}

/* Tap hint - positioned below spread */
.tap-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 5px;
    opacity: 0.8;
}

/* Action buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    padding-bottom: 40px;
}

.action-buttons .btn {
    margin: 0;
    padding: 12px 25px;
    font-size: 0.95rem;
}

/* Rate limit message */
.rate-limit-msg {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #EF4444;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    max-width: 300px;
}

.rate-limit-msg p {
    color: #FCA5A5;
    font-size: 0.9rem;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* New reading button (always visible during reading) */
.new-reading-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    background: var(--bg-card);
    border: 1px solid var(--purple);
    color: var(--text-muted);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 50;
    transition: all 0.3s;
}

.new-reading-btn:hover {
    border-color: var(--teal);
    color: var(--text-light);
}

/* Region indicator */
.region-indicator {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 40px;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
    animation: textGlow 2s ease-in-out infinite;
}

.region-indicator span {
    color: var(--teal);
}

/* Hide on specific screens */
.hide-on-start {
    display: none;
}

/* Scroll indicator - positioned 75% right */
.scroll-indicator {
    position: fixed;
    bottom: 25px;
    right: 12%;
    color: var(--purple);
    font-size: 2rem;
    pointer-events: none;
    z-index: 150;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.8);
    opacity: 0;
    transition: opacity 0.3s;
}

.scroll-indicator.visible {
    opacity: 1;
    animation: scrollBounce 1.2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { 
        transform: translateY(0);
    }
    50% { 
        transform: translateY(10px);
    }
}

/* Confirmation modal */
.confirm-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.confirm-modal.active {
    display: flex;
}

.confirm-box {
    background: linear-gradient(135deg, var(--bg-card) 0%, #1a1a2e 100%);
    border: 2px solid var(--purple);
    border-radius: 20px;
    padding: 30px;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 0 40px rgba(168, 85, 247, 0.3);
    animation: modalPop 0.3s ease-out;
}

@keyframes modalPop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.confirm-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    animation: breathe 2s ease-in-out infinite;
}

.confirm-title {
    color: var(--purple);
    font-size: 1.4rem;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.confirm-message {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

.confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-buttons .btn {
    margin: 0;
    padding: 12px 20px;
    font-size: 0.9rem;
}
/* Legal Footer */
.legal-footer {
    margin-top: 20px;
    font-size: 0.75rem;
}

.legal-footer a {
    color: #A855F7;
    opacity: 0.6;
    text-decoration: none;
    transition: opacity 0.3s;
}

.legal-footer a:hover {
    opacity: 1;
}
.legal-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.legal-sep {
    color: var(--text-muted);
    opacity: 0.3;
    font-size: 0.7rem;
}