:root {
    --neon-pink: #ff00ff;
    --neon-blue: #00ffff;
    --neon-purple: #9d00ff;
    --bg-dark: #0a0a0f;
    --card-bg: rgba(20, 20, 30, 0.8);
    --text-color: #e0e0e0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* 전역 더블 탭 확대 방지 */
}

body.cyberpunk-theme {
    background-color: var(--bg-dark);
    color: var(--text-color);
    font-family: 'Orbitron', 'Noto Sans KR', 'Noto Sans JP', sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image:
        linear-gradient(rgba(13, 13, 18, 0.8) 0%, rgba(13, 13, 18, 0.8) 100%),
        url('https://www.transparenttextures.com/patterns/carbon-fibre.png');
}

#app {
    width: 100%;
    max-width: 500px;
    height: 100%;
    height: 100%;
    padding: 20px;
    padding-top: 30px;
    /* 상단 여백 약간 축소 */
    /* 상단 여백 추가 */
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto;
    /* 내용이 넘치면 스크롤 허용 */
    overflow-x: hidden;
}

/* Lang Switcher */
.lang-switcher {
    position: absolute;
    top: 20px;
    /* 상단 여백 추가 확보 */
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

/* Interaction Lock */
body.interaction-disabled {
    pointer-events: none !important;
}

.lang-switcher a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 5px 10px;
    border: 1px solid var(--neon-blue);
    border-radius: 4px;
    transition: all 0.3s;
}

.lang-switcher a.active,
.lang-switcher a:hover {
    background: var(--neon-blue);
    color: #000;
    box-shadow: 0 0 10px var(--neon-blue);
}

header {
    text-align: center;
    margin-top: 30px;
    /* 전체적으로 위로 당김 */
    /* 버튼 위치 조정에 따른 여백 확보 */
    margin-bottom: 20px;
}

.neon-text {
    font-size: 2.0rem;
    color: #fff;
    text-shadow:
        0 0 5px #fff,
        0 0 10px var(--neon-pink),
        0 0 20px var(--neon-pink),
        0 0 40px var(--neon-pink);
    animation: neon-flicker 2s infinite alternate;
}

@keyframes neon-flicker {

    0%,
    18%,
    22%,
    25%,
    53%,
    57%,
    100% {
        text-shadow: 0 0 5px #fff, 0 0 10px var(--neon-pink), 0 0 20px var(--neon-pink);
    }

    20%,
    24%,
    55% {
        text-shadow: none;
    }
}

.subtitle {
    font-size: 0.9rem;
    color: var(--neon-blue);
    opacity: 0.8;
}

/* Offering Zone */
.offering-zone {
    text-align: center;
    margin-bottom: 20px;
}

.offering-btn {
    background: transparent;
    border: 1px solid var(--neon-purple);
    color: var(--neon-purple);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

.offering-btn:hover {
    background: var(--neon-purple);
    color: #fff;
    box-shadow: 0 0 10px var(--neon-purple);
}

.offering-btn.liked {
    background: var(--neon-pink);
    border-color: var(--neon-pink);
    color: #fff;
    box-shadow: 0 0 15px var(--neon-pink);
}

/* Stages */
.stage {
    display: none;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stage.active {
    display: flex;
}

/* Simple Rectangular Box (Fast & Clean Cyberpunk) */
.box-container,
.drawing-box-container {
    margin: 30px auto;
    width: 200px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 800px;
}

.cyber-box {
    width: 120px;
    height: 220px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-15deg) rotateY(15deg);
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    touch-action: manipulation;
    /* 더블 탭 줌 방지 */
}

.box-face {
    position: absolute;
    box-sizing: border-box;
    border: 3px solid var(--neon-purple);
    background: rgba(15, 5, 25, 0.9);
    box-shadow: 0 0 15px rgba(157, 0, 255, 0.5);
    backdrop-filter: blur(5px);
}

.box-face.front {
    width: 120px;
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    /* 텍스트 간격 */
    z-index: 2;
    transform: translateZ(30px);
}

.box-face.front .main-text {
    writing-mode: vertical-rl;
    font-size: 2rem;
    font-weight: 900;
    color: var(--neon-purple);
    text-shadow: 0 0 10px var(--neon-purple), 0 0 20px var(--neon-purple);
    font-family: 'Noto Sans JP', sans-serif;
    letter-spacing: 12px;
}

.box-face.front .sub-text {
    writing-mode: vertical-rl;
    font-size: 1rem;
    font-weight: 700;
    color: #00ffcc;
    /* Neon Cyan */
    text-shadow: 0 0 5px #00ffcc;
    font-family: 'Noto Sans KR', sans-serif;
    letter-spacing: 8px;
    opacity: 0.9;
}

.box-face.front .sub-text.en {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    /* 영문은 조금 더 작게 */
    letter-spacing: 3px;
    /* 자간 좁힘 */
    text-orientation: mixed;
    /* 알파벳 회전 방지 (세로쓰기 시 눕혀짐 방지 or 유지) -> upright or mixed */
    /* Orbitron은 세로쓰기 시 mixed가 기본, 눕혀진 상태로 긴 라벨 느낌 */
}

.box-face.top {
    width: 120px;
    height: 60px;
    top: -30px;
    transform: rotateX(90deg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

/* The Hole on top */
.box-hole {
    width: 30px;
    height: 30px;
    background: #000;
    border-radius: 50%;
    border: 2px solid var(--neon-pink);
    box-shadow: 0 0 15px var(--neon-pink), inset 0 0 5px var(--neon-pink);
    position: relative;
}

.box-hole::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--neon-pink) 0%, transparent 70%);
    opacity: 0.3;
}

/* Interaction: Hide stick in Stage 1 */
#ritual-stage .mikuji-stick,
#ritual-stage .stick-container {
    display: none !important;
}

.mikuji-stick {
    position: absolute;
    width: 10px;
    height: 180px;
    background: linear-gradient(to bottom, #ffd700, #b8860b);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    left: 50%;
    margin-left: -5px;
    opacity: 0;
    /* Position inside the prism center */
    transform: translateZ(35px) translateY(120px);
    z-index: 2;
    /* Inside the box but above the bottom */
}

.drawing-mode .pulling-out {
    opacity: 1;
    animation: pop-up 1.5s ease-out forwards;
}

@keyframes pop-up {
    0% {
        transform: translateZ(0px) translateY(120px);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateZ(0px) translateY(-140px) rotateZ(10deg);
        opacity: 1;
    }
}

/* Drawing stage */
.drawing-box-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.blink-text {
    animation: blink 1s infinite;
    color: var(--neon-blue);
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* Result Paper Style */
.paper-container {
    perspective: 1000px;
    width: 100%;
}

.omikuji-paper {
    width: 220px;
    min-height: 450px;
    background: rgba(240, 240, 240, 0.95);
    margin: 0 auto;
    border: 1px dashed #333;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #111;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.4);
    animation: unfold 1s cubic-bezier(0.23, 1, 0.32, 1);
    transform-origin: top;
    font-family: 'Noto Sans JP', 'Noto Sans KR', sans-serif;
}

@keyframes unfold {
    0% {
        transform: rotateX(-90deg) scaleY(0);
        opacity: 0;
    }

    100% {
        transform: rotateX(0deg) scaleY(1);
        opacity: 1;
    }
}

/* Result Stage (Rollback to Neon Card) */
.neon-card {
    background: rgba(15, 15, 25, 0.95);
    border: 3px solid var(--neon-blue);
    border-radius: 25px;
    padding: 30px 20px;
    /* 내부 여백 축소 */
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.4),
        inset 0 0 15px rgba(0, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin: 10px auto;
    /* 카드 외부 여백 최소화 */
    /* 외부 여백 축소 */
}

.result-header {
    font-size: 1.5rem;
    /* 폰트 사이즈 축소 */
    font-weight: bold;
    margin-bottom: 15px;
    /* 하단 여백 축소 */
}

.text-pink {
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
}

.glow-text {
    font-size: 2.8rem;
    color: #fff;
    text-shadow: 0 0 10px #fff, 0 0 20px var(--neon-blue);
    margin-bottom: 15px;
    /* 중요도 높은 텍스트 여백 축소 */
    font-family: 'Orbitron', sans-serif;
}

.fortune-ment {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #fff;
    margin-bottom: 15px;
    /* 설명 텍스트 하단 여백 축소 */
    word-break: keep-all;
}

.mt-40 {
    margin-top: 20px;
    /* 하단 버튼 간격 축소 */
    display: flex;
    flex-direction: column;
    gap: 5px;
    /* 버튼 사이 간격 대폭 축소 */
    align-items: center;
}

.x-btn {
    background-color: #000 !important;
    border: 1px solid #333 !important;
    color: #fff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: sans-serif;
    /* X 로고용 */
}

.x-btn:hover {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5) !important;
    border-color: #fff !important;
}

.x-logo {
    font-weight: bold;
    font-size: 1.1em;
    /* 로고 사이즈 축소 */
}

.line-btn {
    background-color: #06C755 !important;
    border: 1px solid #05b34c !important;
    color: #fff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.line-btn:hover {
    box-shadow: 0 0 15px rgba(6, 199, 85, 0.5) !important;
    border-color: #fff !important;
}

/* Native/Generic Share Button */
.share-generic-btn {
    background: linear-gradient(45deg, #8A2BE2, #4B0082) !important;
    /* Violet to Indigo */
    border: 1px solid #9370DB !important;
    color: #fff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: bold;
}

.share-generic-btn:hover {
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.6) !important;
    border-color: #fff !important;
    transform: translateY(-2px);
}

.share-generic-btn .icon {
    font-size: 1.2em;
}

.blue-btn {
    border: 3px solid var(--neon-blue) !important;
    color: var(--neon-blue) !important;
}

.blue-btn:hover {
    background: var(--neon-blue) !important;
    color: #000 !important;
    box-shadow: 0 0 20px var(--neon-blue);
}

.pink-btn {
    border: 3px solid var(--neon-pink) !important;
    color: var(--neon-pink) !important;
}

.pink-btn:hover {
    background: var(--neon-pink) !important;
    color: #000 !important;
    box-shadow: 0 0 20px var(--neon-pink);
}

/* Common Cyber Button */
.cyber-btn {
    padding: 8px 16px;
    /* 높이 대폭 축소 */
    background: transparent;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 0.9rem;
    /* 폰트 사이즈 축소 */
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    border-radius: 5px;
    text-transform: uppercase;
    margin-bottom: 5px;
    /* 마진 대폭 축소 */
}

/* Shredder / Exorcism */
#shredder-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

.paper-shredding {
    width: 150px;
    height: 200px;
    background: #fff;
    animation: shred 2s forwards;
    position: relative;
    overflow: hidden;
}

.paper-shredding::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(90deg, transparent, transparent 10px, #000 10px, #000 12px);
    transform: translateY(100%);
    animation: shred-lines 2s forwards;
}

@keyframes shred {
    0% {
        height: 200px;
    }

    100% {
        height: 0px;
    }
}

.exorcism-msg {
    margin-top: 30px;
    color: var(--neon-blue);
    text-align: center;
    padding: 0 20px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .neon-text {
        font-size: 1.8rem;
    }

    .pc-only {
        display: none;
    }
}

@media (min-width: 481px) {
    .mobile-only {
        display: none;
    }
}