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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: white;
    color: black;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Landing Page */
/* Landing Page */
.landing-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
}

.landing-page.fade-out {
    opacity: 0;
    visibility: hidden;
}

.landing-text {
    font-family: "Anton", sans-serif;
    font-size: 42px;
    font-weight: 400;
    color: black;
    margin: 0;
    text-align: center;
    position: relative;
    top: -120px;
    white-space: nowrap;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        visibility: visible;
    }
    to {
        opacity: 0;
        visibility: hidden;
    }
}

.landing-page.fade-out {
    animation: fadeOut 0.8s ease-in-out forwards;
}

.logo-header {
    position: fixed;
    top: 15px;
    left: 0;
    right: 0;
    width: 100%;
    text-align: center;
    z-index: 100;
    display: none;
}

.logo-header.show {
    display: block;
}

.logo-text {
    font-family: "Anton", sans-serif;
    font-size: 18px;
    font-weight: 400;
    color: black;
    margin: 0;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.logo-text:hover {
    opacity: 0.6;
}

/* Step 페이지 - 콘텐츠 영역 */
.step {
    position: absolute;
    width: 100%;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    pointer-events: none;
}

.step.active {
    opacity: 1;
    pointer-events: auto;
}

/* Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    padding: 20px;
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.popup-container {
    background-color: white;
    padding: 40px 30px;
    max-width: 560px; /* 팝업 폭 약간 확대 */
    width: 100%;
    text-align: center;
    border-radius: 0;
    transform: translateY(20px);
    transition: transform 0.5s ease;
}

.popup-overlay.show .popup-container {
    transform: translateY(0);
}

.popup-container p {
    font-size: 20px;
    line-height: 1.6;
    color: black;
    margin: 0;
    /* 단어 단위 줄바꿈: 한국어/영문 혼용 최적화 */
    white-space: normal;
    word-break: keep-all;      /* 한글은 음절 단위로 끊기지 않도록 */
    overflow-wrap: break-word; /* 긴 영문 단어는 단어 경계에서 줄바꿈 */
}

/* 팝업 메시지에 명시적으로 동일 규칙 적용 */
#popupMessage {
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.popup-actions {
    margin-top: 20px;
}

.popup-actions .btn {
    display: block;
    width: 100%; /* 여백 제거: 컨테이너 폭에 맞춤 */
    margin: 0; /* 팝업 버튼의 좌우/하단 여백 제거 */
}

.popup-actions .btn-primary {
    background-color: white;
    color: black;
    border-color: black;
    width: 50%;
    margin: 0 auto;
    padding: 10px 30px;
}

.popup-actions .btn-primary:hover {
    background-color: #f5f5f5;
    color: black;
}

.selection-container {
    margin-bottom: 40px;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.wheel-columns {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.wheel-wrapper {
    position: relative;
    width: 100%;
}

.wheel-label {
    font-family: "Anton", sans-serif;
    font-size: 16px;
    margin-bottom: 30px;
    text-align: center;
    color: black;
}

    .wheel-guide {
        font-size: 12px;
        color: #373737;
        text-align: center;
        margin-top: 14px;
        font-weight: 300;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    }

.wheel-swiper {
    position: relative;
    height: 200px;
    border: 2px solid rgba(0, 0, 0, 0.63);
    background: white;
    overflow: hidden;
    isolation: isolate;
}

#wheelA,
#wheelB,
#wheelC {
    border: none;
    background: #f2f2f2;
}

.wheel-swiper .swiper-wrapper {
    align-items: center;
    position: relative;
    z-index: 2; /* keep content above highlights */
}

.wheel-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    font-family: "Anton", sans-serif;
    font-size: 24px;
    font-weight: 400;
    color: #888;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: relative;
    z-index: 1; /* keep below gradient overlays */
}

.wheel-swiper .swiper-slide-active,
.wheel-swiper .swiper-slide-duplicate-active {
    color: black; /* 선택된 단어는 블랙 */
    font-weight: 400;

}

#wheelA,
#wheelB,
#wheelC {
    position: relative;
}

.wheel-swiper::before,
.wheel-swiper::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 28px; /* 그라데이션 영역 확대 (상/하단 모두 적용) */
    pointer-events: none;
    z-index: 5; /* overlay above slides */
}

.wheel-swiper::before {
    top: 0;
    background: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.1) 60%, rgba(255,255,255,0) 100%);
}

.wheel-swiper::after {
    bottom: 0;
    background: linear-gradient(0deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.1) 60%, rgba(255,255,255,0) 100%);
}

.wheel::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.select-group {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.select-group label {
    font-size: 18px;
    font-weight: 500;
    min-width: 30px;
}

.select-group select {
    flex: 1;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid black;
    background-color: white;
    color: black;
    border-radius: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 40px;
}

.select-group select:focus {
    outline: none;
    border-color: #333;
}

.btn {
    /* max-width: 320px; */
    width: 100%;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid black;
    background-color: white;
    color: black;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}

.btn:hover {
    background-color: black;
    color: white;
}

/* 단일 CTA 및 저장하기 버튼 전용 스타일 */
.btn-primary {
    background-color: black;
    color: white;
    border-color: black;
}

.btn-primary:hover {
    background-color: #222;
    color: white;
}

.btn:active {
    transform: scale(0.98);
}

.result-container {
    background-color: white;
    width: calc(100% - 40px);
    max-width: 540px;
    aspect-ratio: 1080 / 1350;
    padding: 60px 30px;
    display: flex;
    flex-direction: column;
    border: 1px solid #cfcfcf;
    margin: 0 auto;
    position: relative;
}

.result-word {
    font-family: "Anton", sans-serif;
    font-size: 44px; /* 기본 폰트 크기 */
    font-weight: 400;
    color: black;
    margin-bottom: 10px;
    line-height: 1.1; /* 행간 약간 축소 */
    white-space: nowrap; /* 단어 줄바꿈 방지 */
    overflow: hidden; /* 넘침 숨김 */
    text-overflow: clip; /* 잘림 표시 없이 클립 */
}

.result-word.left {
    text-align: left;
}

.result-word.right {
    text-align: right;
    padding-right: 4px; /* 마지막 문자 잘림 방지 */
}

#wordC {
    -webkit-text-stroke: 1px black;
    color: white;
    overflow: visible;
}

.result-logo {
    font-family: "Anton", sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: black;
    text-align: left;
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    margin: 0;
    padding: 0;
    word-break: break-word;
    overflow: hidden;
}

.spacer {
    flex-grow: 1;
}

.button-group {
    display: flex;
    flex-direction: row; /* 한 줄 배치 */
    justify-content: center;
    gap: 10px;
}

.footer-fixed {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 15px;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    z-index: 50;
}

/* Toast */
.toast {
    position: fixed;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 3000;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Mobile optimization */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }

    .popup-container {
        padding: 30px 20px;
    }

    .popup-container p {
        font-size: 16px;
    }

    .select-group {
        margin-bottom: 15px;
    }

    .select-group label {
        font-size: 16px;
    }

    .select-group select {
        font-size: 14px;
        padding: 10px 12px;
    }

    .result-word {
        font-size: 40px; /* 모바일에서 더 작게 */
    }

    .result-container {
        padding: 20px 20px;
        min-height: 350px;
    }

    .btn {
        font-size: 16px;
        padding: 12px 25px;
    }
}

@media (max-width: 360px) {
    .result-word {
        font-size: 36px; /* 초소형 화면에서 더 작게 */
    }

    .result-container {
        padding: 30px 15px;
        min-height: 300px;
    }
}
