/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-purple: #a855f7;
    --secondary-purple: #7c3aed;
    --deep-purple: #5b21b6;
    --accent-pink: #ec4899;
    --accent-cyan: #06b6d4;
    --dark-bg: #0f0820;
    --darker-bg: #070312;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8f9fa;
    --text-secondary: #cbd5e1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 50%, #1a0b2e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ==================== ANIMATED STARS BACKGROUND ==================== */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.stars, .stars2, .stars3 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.stars {
    background-image: 
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 60px 70px, white, transparent),
        radial-gradient(1px 1px at 50px 50px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, white, transparent),
        radial-gradient(2px 2px at 90px 10px, white, transparent);
    background-size: 200px 200px;
    animation: twinkle 3s infinite;
}

.stars2 {
    background-image: 
        radial-gradient(1px 1px at 100px 120px, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 170px 160px, rgba(255, 255, 255, 0.7), transparent);
    background-size: 300px 300px;
    animation: twinkle 5s infinite 1s;
}

.stars3 {
    background-image: 
        radial-gradient(1px 1px at 80px 90px, rgba(168, 85, 247, 0.5), transparent),
        radial-gradient(2px 2px at 180px 30px, rgba(236, 72, 153, 0.5), transparent);
    background-size: 250px 250px;
    animation: twinkle 7s infinite 2s;
}

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

/* ==================== MAIN APP CONTAINER ==================== */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ==================== SCREEN MANAGEMENT ==================== */
.screen {
    display: none;
    opacity: 0;
    width: 100%;
    max-width: 900px;
    animation: fadeOut 0.3s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 1;
    animation: fadeIn 0.5s ease;
}

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

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

/* ==================== WELCOME SCREEN ==================== */
.mystical-orb {
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--primary-purple), var(--deep-purple));
    box-shadow: 
        0 0 60px rgba(168, 85, 247, 0.6),
        0 0 120px rgba(168, 85, 247, 0.3),
        inset 0 0 40px rgba(255, 255, 255, 0.1);
    animation: orbPulse 4s ease-in-out infinite;
}

@keyframes orbPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 
            0 0 60px rgba(168, 85, 247, 0.6),
            0 0 120px rgba(168, 85, 247, 0.3),
            inset 0 0 40px rgba(255, 255, 255, 0.1);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 
            0 0 80px rgba(168, 85, 247, 0.8),
            0 0 160px rgba(168, 85, 247, 0.4),
            inset 0 0 50px rgba(255, 255, 255, 0.2);
    }
}

.main-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.title-glow {
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-pink), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.6));
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    text-align: center;
}

.screen-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.screen-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    text-align: center;
}

.greeting-text {
    font-size: 1.1rem;
    font-style: italic;
}

/* ==================== INPUT FIELDS ==================== */
.input-container {
    width: 100%;
    max-width: 400px;
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* ==================== BUTTONS ==================== */
.primary-btn,
.secondary-btn {
    position: relative;
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--primary-purple), var(--secondary-purple));
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.4);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(168, 85, 247, 0.6);
}

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

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.primary-btn:hover .btn-glow {
    left: 100%;
}

.secondary-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    box-shadow: none;
    margin-left: 10px;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-purple);
}

.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 10px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-purple);
    transform: translateX(-3px);
}

/* ==================== USAGE STATS ==================== */
.usage-stats {
    width: 100%;
    max-width: 400px;
    margin-top: 30px;
    padding: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--primary-purple);
}

.luck-meter {
    flex: 1;
    height: 8px;
    margin: 0 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.luck-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-pink), var(--primary-purple), var(--accent-cyan));
    border-radius: 10px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.6);
}

/* ==================== CATEGORIES GRID ==================== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
}

.category-card {
    padding: 30px 20px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.2), transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.category-card:hover::before {
    width: 300px;
    height: 300px;
}

.category-card:hover {
    border-color: var(--primary-purple);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.4);
}

.category-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.category-card.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--glass-border);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.category-card h3 {
    font-size: 1.4rem;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.category-uses {
    font-size: 0.85rem;
    color: var(--primary-purple);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* ==================== COOLDOWN NOTICE ==================== */
.cooldown-notice {
    padding: 15px 25px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: 12px;
    color: var(--warning);
    font-size: 0.95rem;
    text-align: center;
    display: none;
}

.cooldown-notice.visible {
    display: block;
    animation: pulseWarning 2s ease-in-out infinite;
}

@keyframes pulseWarning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ==================== CARDS ==================== */
.cards-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.tarot-card {
    width: 180px;
    height: 280px;
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.tarot-card:hover {
    transform: translateY(-15px);
}

.card-back {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--deep-purple), var(--dark-bg));
    border: 2px solid var(--primary-purple);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(168, 85, 247, 0.4);
    transition: all 0.3s ease;
}

.tarot-card:hover .card-back {
    box-shadow: 0 15px 60px rgba(168, 85, 247, 0.7);
    border-color: var(--accent-pink);
}

.card-pattern {
    position: absolute;
    inset: 10px;
    background: 
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(168, 85, 247, 0.1) 10px, rgba(168, 85, 247, 0.1) 20px),
        repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(236, 72, 153, 0.1) 10px, rgba(236, 72, 153, 0.1) 20px);
    border-radius: 12px;
}

.card-glow-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.3), transparent);
    transform: translate(-50%, -50%);
    animation: cardGlow 3s ease-in-out infinite;
}

@keyframes cardGlow {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

.card-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
}

/* ==================== FORTUNE REVEAL ==================== */
.fortune-container {
    width: 100%;
    max-width: 600px;
    text-align: center;
}

.chosen-card-display {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.card-reveal {
    width: 200px;
    height: 300px;
    background: linear-gradient(135deg, var(--primary-purple), var(--deep-purple));
    border: 3px solid var(--accent-pink);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 60px rgba(168, 85, 247, 0.6);
    animation: revealCard 0.8s ease;
}

@keyframes revealCard {
    0% {
        transform: rotateY(90deg) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: rotateY(0) scale(1);
        opacity: 1;
    }
}

.card-symbol {
    font-size: 5rem;
    animation: symbolGlow 2s ease-in-out infinite;
}

@keyframes symbolGlow {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
    }
    50% { 
        transform: scale(1.1);
        filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.8));
    }
}

.fortune-title {
    font-size: 2rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--accent-pink), var(--primary-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fortune-text {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 40px;
    padding: 25px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.fortune-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.next-reading-timer {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 12px 20px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: 10px;
    display: none;
}

.next-reading-timer.visible {
    display: block;
}

/* ==================== HISTORY ==================== */
.history-container {
    width: 100%;
    max-width: 700px;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
}

.empty-history {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-style: italic;
}

.history-item {
    padding: 20px;
    margin-bottom: 15px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--primary-purple);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-category {
    font-weight: 600;
    color: var(--primary-purple);
    text-transform: uppercase;
    font-size: 0.9rem;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.history-fortune {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* ==================== ADMIN PANEL ==================== */
.admin-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.admin-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.admin-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.admin-panel.active {
    display: flex;
}

.admin-content {
    background: var(--dark-bg);
    border: 2px solid var(--primary-purple);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(168, 85, 247, 0.4);
}

.admin-content h3 {
    font-size: 2rem;
    margin-bottom: 25px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-lock {
    display: flex;
    gap: 10px;
}

.admin-lock input {
    flex: 1;
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
}

.admin-lock input:focus {
    outline: none;
    border-color: var(--primary-purple);
}

.admin-lock button {
    padding: 12px 24px;
    background: var(--primary-purple);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-lock button:hover {
    background: var(--secondary-purple);
    transform: translateY(-2px);
}

.admin-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-controls.hidden {
    display: none;
}

.admin-option {
    padding: 15px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
}

.admin-option label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
}

.admin-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.admin-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-purple);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-btn:hover {
    background: var(--secondary-purple);
    transform: translateY(-2px);
}

.admin-btn.danger {
    background: var(--danger);
}

.admin-btn.danger:hover {
    background: #dc2626;
}

.close-admin {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-admin:hover {
    background: var(--danger);
    transform: rotate(90deg);
}

/* ==================== CONFETTI ==================== */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-purple);
    opacity: 0;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }

    .screen-title {
        font-size: 2rem;
    }

    .categories-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .cards-container {
        gap: 15px;
    }

    .tarot-card {
        width: 140px;
        height: 220px;
    }

    .card-reveal {
        width: 160px;
        height: 240px;
    }

    .card-symbol {
        font-size: 4rem;
    }

    .fortune-actions {
        flex-direction: column;
    }

    .secondary-btn {
        margin-left: 0;
        width: 100%;
    }

    .admin-content {
        padding: 25px;
    }

    .back-btn {
        top: 10px;
        left: 10px;
    }
}

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

    .mystical-orb {
        width: 90px;
        height: 90px;
    }

    .categories-grid {
        gap: 15px;
    }

    .category-card {
        padding: 20px 15px;
    }

    .category-icon {
        font-size: 2.5rem;
    }

    .tarot-card {
        width: 120px;
        height: 190px;
    }
}

/* ==================== UTILITY CLASSES ==================== */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Custom scrollbar */
.history-container::-webkit-scrollbar {
    width: 8px;
}

.history-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.history-container::-webkit-scrollbar-thumb {
    background: var(--primary-purple);
    border-radius: 10px;
}

.history-container::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-purple);
}
