* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #121638;
    color: #f0f0f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    padding: 20px 20px 30px 20px; /* 하단 패딩을 30px로 수정 */
}

#app {
    max-width: 100%;
    margin: 0 auto;
    padding: 5px;
    flex: 1;
    margin-bottom: 20px !important; /* 앱 컨테이너 하단 여백 추가 */
}

/* footer 스타일 추가 */
.footer {
    margin-top: auto; /* 하단에 고정 */
    padding: 10px 0; /* 상하 패딩 축소 */
    width: 100%;
    background-color: rgba(18, 22, 56, 0.9);
    border-top: 1px solid rgba(224, 192, 128, 0.3);
}

/* 앱 버전 표시 영역 스타일 추가 */
#appVersionDisplay {
    margin-bottom: 100px; /* 하단 여백 추가 */
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.screen.active {
    display: flex;
}

h1, h2 {
    text-align: center;
    margin-bottom: 10px;
    color: #e0c080;
}

h3 {
    text-align: center;
    margin-bottom: 8px;
    color: #e0c080;
}

button {
    background-color: #2c3e50;
    color: #fff;
    border: none;
    padding: 12px 20px;
    margin: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #34495e;
}

button:disabled {
    background-color: #7f8c8d;
    cursor: not-allowed;
}

.reading-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
    width: 100%;
    max-width: 400px;
}

/* 리딩 옵션 버튼 그룹 스타일 */
.reading-options button {
    width: 100%;
    background-color: #2c3e50;
    color: #e0c080;
    border: 2px solid #e0c080;
    padding: 15px 20px;
    margin: 8px 0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    perspective: 1000px;
    transform-style: preserve-3d;
    position: relative;
    box-shadow: 0 0 5px #e0c080,
                0 0 10px #e0c080,
                0 0 20px #e0c080;
    text-shadow: 0 0 5px #e0c080;
    animation: neonPulse 1.5s infinite alternate;
}

.reading-options button:hover {
    background-color: #34495e;
    transform: translateX(5px);
    box-shadow: 0 0 10px #e0c080,
                0 0 20px #e0c080,
                0 0 40px #e0c080;
}

@keyframes neonPulse {
    from {
        box-shadow: 0 0 5px #e0c080,
                    0 0 10px #e0c080,
                    0 0 20px #e0c080;
    }
    to {
        box-shadow: 0 0 10px #e0c080,
                    0 0 20px #e0c080,
                    0 0 30px #e0c080;
    }
}

.reading-options button:active {
    animation: spinZ 1.0s ease-in-out;
}

@keyframes spinZ {
    0% {
        transform: rotateZ(0deg);
    }
    100% {
        transform: rotateZ(180deg);
    }
}

/* 기능 버튼 스타일 (리딩보기, 처음으로, 새로운 리딩) */
#complete-selection,
#back-to-home,
#new-reading {
    width: 200px;
    background-color: #4a5568;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 0;
    margin: 10px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#complete-selection:hover,
#back-to-home:hover,
#new-reading:hover {
    background-color: #2d3748;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-color: rgba(224, 192, 128, 0.3);
}

#complete-selection:active,
#back-to-home:active,
#new-reading:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

#complete-selection:disabled {
    background-color: #718096;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
    box-shadow: none;
}

.card-back-options {
    margin-top: 30px;
    text-align: center;
}

.back-selection {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.back-option {
    cursor: pointer;
    padding: 10px;
    border-radius: 5px;
    transition: transform 0.3s;
}

.back-option.selected {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.back-option img {
    width: 80px;
    height: auto;
    border-radius: 5px;
}

#deck-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 80px 0;
}

#deck {
    position: relative;
    width: 100px;
    height: 150px;
}

.card {
    position: absolute;
    width: 120px;
    height: 200px;
    border-radius: 5px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 2.3);
    transition: transform 0.1s ease;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-10px);
}

#selected-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.card, .selected-card, .back-option {
    cursor: url('./assets/finger.png') 15 0, pointer;
}

/* 덱 영역 스타일 수정 */
#deck {
    position: relative;
    width: 100px;
    height: 150px;
    cursor: url('./assets/finger.png') 15 0, pointer;
}

/* 카드 뒷면 옵션 스타일 수정 */
.back-option {
    padding: 10px;
    border-radius: 5px;
    transition: transform 0.3s;
    cursor: url('./assets/finger.png') 15 0, pointer;
}

/* 선택된 카드 스타일 수정 */
.selected-card {
    width: 120px;
    height: 200px;
    border-radius: 5px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.5s ease;
    cursor: url('./assets/finger.png') 15 0, pointer;
}

.selected-card.flipped {
    transform: rotateY(180deg);
}

.selected-card.reversed {
    transform: rotate(180deg);
}

.selected-card.flipped.reversed {
    transform: rotateY(180deg) rotate(180deg);
}

#reading-layout {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin: 20px 0;
    max-width: 800px;
}

.layout-card {
    width: 120px;
    height: 200px;
    border-radius: 5px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

.layout-card.reversed {
    transform: rotate(180deg);
}

.card-position {
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 14px;
    color: #e0c080;
}

#reading-interpretation {
    margin: 20px 0;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    max-width: 800px;
}

#reading-interpretation p {
    margin-bottom: 20px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    line-height: 1.3;
}

#reading-interpretation p:last-child {
    margin-bottom: 0;
}

#reading-interpretation p strong {
    display: block;
    color: #e0c080;
    font-size: 1.1em;
    margin-bottom: 2px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(224, 192, 128, 0.3);
}

/* Cross layout for 7-card reading */
.cross-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 40px !important; 
    margin-bottom: 20px !important;
}

.cross-layout .layout-card:nth-child(1) {
    grid-column: 2;
    grid-row: 1;
}

.cross-layout .layout-card:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
}

.cross-layout .layout-card:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

.cross-layout .layout-card:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
}

.cross-layout .layout-card:nth-child(5) {
    grid-column: 2;
    grid-row: 3;
}

.additional-cards {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* 커서 클래스 */
.cursor-pointer {
    cursor: pointer;
}

@media (max-width: 768px) {
    .cross-layout {
        gap: 10px;
    }
    
    .layout-card, .selected-card, .card {
        width: 90px;
        height: 150px;
    }
    
    .back-option img {
        width: 80px;
    }
}

#position-labels {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.position-label {
    width: 100px;
    text-align: center;
    color: #e0c080;
    font-size: 0.9em;
    padding: 5px;
    border-bottom: 1px solid #e0c080;
}

#selected-cards {
    display: flex;
    flex-direction: row;  /* column에서 row로 변경 */
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    position: relative;  /* 추가 */
}

#position-labels {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;  /* 여백 증가 */
    width: 100%;  /* 추가 */
}

.position-label {
    width: 120px;  /* 카드 너비와 동일하게 조정 */
    text-align: center;
    color: #e0c080;
    font-size: 1em;  /* 글자 크기 증가 */
    padding: 8px;  /* 패딩 증가 */
    border-bottom: 2px solid #e0c080;  /* 테두리 두께 증가 */
    margin-bottom: 10px;  /* 추가 */
}

/* 모바일 대응을 위한 미디어 쿼리 수정 */
@media (max-width: 768px) {
    #position-labels {
        gap: 10px;
    }
    
    .position-label {
        width: 90px;
        font-size: 0.8em;
    }
}