* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: white;
    font-family: "Noto Sans KR", sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    overflow-x: hidden;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-align: center;
    background: linear-gradient(45deg, #ffd700, #ffed4e, #ffd700);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.subtitle {
    font-size: 1rem;
    color: #b8b8d4;
    margin-bottom: 40px;
    text-align: center;
}

.card-deck {
    margin-top: 100px;
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 350px;
    perspective: 1200px;
    margin-bottom: 40px;
}

.card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90px;
    height: 140px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translate(-50%, -50%) rotate(calc(var(--i) * 8deg)) translateY(-80px);
    transform-origin: bottom center;
}

.card:hover:not(.selected) {
    transform: translate(-50%, -50%) rotate(calc(var(--i) * 8deg)) translateY(-90px) scale(1.05);
    filter: drop-shadow(0 10px 20px rgba(255, 215, 0, 0.3));
}

.card.selected {
    transform: translate(-50%, -50%) rotate(calc(var(--i) * 8deg)) translateY(-120px) scale(1.15);
    z-index: 10;
}

.card.selected .card-back {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
}

.card.revealed {
    transform: translate(-50%, -50%) rotate(calc(var(--i) * 8deg)) translateY(-120px) scale(1.15) rotateY(180deg);
}

.card.shuffling {
    animation: shuffleAnimation 0.8s ease-in-out;
}

@keyframes shuffleAnimation {
    0% {
        transform: translate(-50%, -50%) rotate(calc(var(--i) * 8deg)) translateY(-80px) scale(1);
    }
    25% {
        transform: translate(-50%, -50%) rotate(calc(var(--i) * 8deg + 180deg)) translateY(-150px) scale(0.8);
    }
    50% {
        transform: translate(-50%, -50%) rotate(calc(var(--i) * 8deg + 360deg)) translateY(-200px) scale(0.6);
    }
    75% {
        transform: translate(-50%, -50%) rotate(calc(var(--i) * 8deg + 180deg)) translateY(-150px) scale(0.8);
    }
    100% {
        transform: translate(-50%, -50%) rotate(calc(var(--i) * 8deg)) translateY(-80px) scale(1);
    }
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    backface-visibility: hidden;
    border: 2px solid #333;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.card-back {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    border: 2px solid #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* .card-back::before {
    content: "";
    position: absolute;
    width: 70%;
    height: 70%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 50%;
} */

.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-back::after {
    content: "✦";
    font-size: 2rem;
    height: 100%;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-52%);
}

.card-front {
    background: linear-gradient(135deg, #f8f8ff 0%, #e6e6fa 100%);
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px;
    overflow: hidden;
    text-align: center;
    transform: rotateY(180deg);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.card-back.hide-after::after {
    display: none;
}

.result {
    width: 100%;
    max-width: 800px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    position: relative;
    min-height: 200px;
}

.result.show {
    opacity: 1;
    transform: translateY(0);
}

.result h2 {
    font-size: 1.5rem;
    color: #ffd700;
    margin-bottom: 30px;
}

.reading-area {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin: 40px 0;
    position: relative;
    min-height: 200px;
}

.reading {
    margin-right: 5%;
}

.card-position {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-height: 180px;
}

.position-label {
    font-size: 1.1rem;
    color: #ffd700;
    margin-bottom: 20px;
    font-weight: 600;
}

.card-slot {
    width: 90px;
    height: 140px;
    border: 2px dashed rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.card-slot.filled {
    border: 2px solid rgba(255, 215, 0, 0.6);
    background: rgba(255, 215, 0, 0.1);
}

.moved-card {
    position: absolute;
    width: 90px;
    height: 140px;
    transition: all 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 100;
    pointer-events: none;
}

.moved-card .card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    backface-visibility: hidden;
    border: 2px solid #ffd700;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.card-info {
    margin-top: 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease;
}

.card-info.show {
    opacity: 1;
    transform: translateY(0);
}

.card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    margin-bottom: 5px;
}

.card-direction {
    font-size: 0.8rem;
    font-weight: 300;
}

.card-direction.reversed {
    color: #ff6b6b;
}

.card-direction:not(.reversed) {
    color: #00b894;
}

.reset-btn {
    margin-top: 30px;
    padding: 12px 30px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
    border: none;
    border-radius: 25px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.instructions {
    color: #b8b8d4;
    font-size: 0.9rem;
    margin-bottom: 20px;
    text-align: center;
}

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.shuffle-btn {
    padding: 10px 25px;
    background: linear-gradient(45deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    border-radius: 20px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.shuffle-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.shuffle-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.reveal-btn {
    padding: 12px 30px;
    background: linear-gradient(45deg, #00b894, #00cec9);
    color: white;
    border: none;
    border-radius: 25px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
    opacity: 0;
    transform: translateY(10px);
}

.reveal-btn.show {
    opacity: 1;
    transform: translateY(0);
}

.reveal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
}

.selection-count {
    color: #ffd700;
    font-size: 1rem;
    margin-bottom: 10px;
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    animation: popupOpen 0.3s ease-out forwards;
}

@keyframes popupOpen {
    to {
        transform: scale(1);
    }
}

.popup-header {
    text-align: center;
    margin-bottom: 30px;
}

.popup-header h1 {
    color: #4a5568;
    font-size: 28px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.popup-header p {
    color: #718096;
    font-size: 16px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #4a5568;
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    min-height: 100px;
}

.privacy-section {
    background: #f8fafc;
    border-radius: 4px 0 0 4px;
    padding: 20px;
    margin: 25px 0;
    border-left: 4px solid #667eea;
}

.privacy-title {
    color: #4a5568;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 16px;
}
.privacy-title i {
    cursor: pointer;
}

.privacy-content {
    color: #718096;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.privacy-content.hide {
    height: 0;
    overflow: hidden;
}

.privacy-content ul {
    margin-left: 20px;
    margin-top: 10px;
    margin-bottom: 30px;
}

.privacy-content li {
    margin-bottom: 5px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 15px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
    transform: scale(1.2);
}

.checkbox-group label {
    margin: 0;
    color: #4a5568;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
}
.form-group textarea {
    resize: none;
}

.required {
    color: #e53e3e;
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: white;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e0;
}

.result-screen {
    display: none;
    text-align: center;
    padding: 40px 20px;
}

.result-screen h2 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 24px;
}

.result-screen p {
    color: #718096;
    font-size: 16px;
    line-height: 1.6;
}

.tarot-cards {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
}

.card {
    width: 60px;
    height: 100px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    animation: float 2s ease-in-out infinite;
}

.card:nth-child(2) {
    animation-delay: 0.3s;
}

.card:nth-child(3) {
    animation-delay: 0.6s;
}

.none-scroll {
    height: 100dvh;
    overflow: hidden;
}

@media (max-width: 768px) {
    .popup {
        padding: 25px;
        margin: 10px;
    }

    .popup-header h1 {
        font-size: 24px;
    }

    .button-group {
        flex-direction: column;
    }

    h1 {
        font-size: 2rem;
    }

    .card {
        width: 70px;
        height: 110px;
    }

    .card-deck {
        height: 280px;
        max-width: 100%;
    }

    .selected-cards {
        grid-template-columns: 1fr;
    }
    .reading-area {
        gap: 1%;
    }

    .popup-header p {
        font-size: 14px;
        white-space: nowrap;
    }
}
