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

/* 스플래시 화면 */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: none; /* 기본적으로 숨김 */
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeOut 0.5s ease 2s forwards;
    margin: 0;
    padding: 0;
}

/* 저장된 상태가 없을 때만 스플래시 화면 표시 */
.splash-screen.show {
    display: flex !important;
}

.splash-image {
    display: block;
    max-width: 400px;
    max-height: 400px;
    width: 60vmin;
    height: 60vmin;
    min-width: 200px;
    min-height: 200px;
    object-fit: contain;
    object-position: center;
    animation: splashPulse 2s ease-in-out;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    .splash-image {
        max-width: 300px;
        max-height: 300px;
        width: 70vmin;
        height: 70vmin;
    }
}

@media (max-width: 480px) {
    .splash-image {
        max-width: 250px;
        max-height: 250px;
        width: 75vmin;
        height: 75vmin;
    }
}

@keyframes splashPulse {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 900px;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.screen {
    display: none !important;
}

.screen.active {
    display: block !important;
}

h1 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: #ffd700;
}

h2 {
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 30px;
    color: #c0c0c0;
}

.intro {
    text-align: center;
    font-size: 1.2em;
    margin-bottom: 40px;
    color: #e0e0e0;
}

.part-cards {
    display: flex !important;
    justify-content: space-around !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    width: 100% !important;
}

.part-card {
    transition: all 0.3s ease !important;
}

.part-card:hover {
    transform: translateY(-10px) !important;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5) !important;
    border-color: #ffed4e !important;
    background: linear-gradient(135deg, #3c4e60 0%, #44596e 100%) !important;
}

.part-card:active {
    transform: translateY(-5px) !important;
}

.character-cards {
    display: flex !important;
    justify-content: space-around !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    width: 100% !important;
}

button.character-card {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    border: 3px solid #ffd700 !important;
    border-radius: 15px !important;
    padding: 20px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    flex: 1 1 200px !important;
    min-width: 200px !important;
    max-width: 300px !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
    pointer-events: auto !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 15px !important;
    margin: 0 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    font-family: inherit !important;
    outline: none !important;
    box-sizing: border-box !important;
}

.character-card {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    border: 3px solid #ffd700 !important;
    border-radius: 15px !important;
    padding: 20px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    flex: 1 1 200px !important;
    min-width: 200px !important;
    max-width: 300px !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
    pointer-events: auto !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 15px !important;
    margin: 0 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    box-sizing: border-box !important;
}

.character-card:hover {
    transform: translateY(-10px) !important;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5) !important;
    border-color: #ffed4e !important;
    background: linear-gradient(135deg, #3c4e60 0%, #44596e 100%) !important;
}

.character-card:active {
    transform: translateY(-5px) !important;
}

.character-icon {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.character-icon img {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.character-info-text {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
}

.character-info-text h3 {
    margin-top: 0;
    margin-bottom: auto;
}

.character-info-text p {
    margin-bottom: 0;
    margin-top: auto;
}

.character-card h3,
.character-info-text h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: #ffd700;
    text-align: left;
}

.character-card p,
.character-info-text p {
    font-size: 1em;
    color: #b0b0b0;
    text-align: left;
}

.game-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ffd700;
}

.character-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.2em;
    gap: 10px;
    flex-wrap: nowrap;
}

#current-character-name {
    font-weight: bold;
    color: #ffd700;
    font-size: 1.4em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.event-counter {
    color: #c0c0c0;
    font-size: 0.9em;
}

.story-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    min-height: 200px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.story-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3;
    z-index: 0;
    transition: opacity 0.5s ease;
}

.story-container:hover .story-image-container {
    opacity: 0.4;
}

.ending-title {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: 2em;
    color: #ffd700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    backdrop-filter: blur(5px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .ending-title {
        font-size: 1.5em;
        padding: 12px;
        white-space: normal;
        word-break: keep-all;
        line-height: 1.4;
    }
}

.story-text {
    position: relative;
    z-index: 1;
    background: rgba(0, 0, 0, 0.6);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.story-text {
    font-size: 1.3em;
    line-height: 1.8;
    color: #fff;
    text-align: justify;
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.choice-btn {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 20px;
    font-size: 1.2em;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-family: inherit;
}

.choice-btn:hover {
    background: linear-gradient(135deg, #5a6578 0%, #3d4758 100%);
    transform: translateX(10px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
    border-color: #ffed4e;
}

.choice-btn:active {
    transform: translateX(5px);
}

.restart-btn {
    margin-top: 30px;
    transition: all 0.3s ease;
}

/* 선택 확인 화면 - 게임 화면 위에 오버레이로 표시 */
#choice-confirm-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.confirm-container {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 20px;
    padding: 35px;
    max-width: 500px;
    width: 90%;
    border: 3px solid #ffd700;
    box-shadow: 0 10px 40px rgba(255, 215, 0, 0.5);
    transform: scale(0.95);
    animation: modalAppear 0.3s ease forwards;
}

@keyframes modalAppear {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.confirm-container h2 {
    text-align: center;
    color: #ffd700;
    font-size: 1.8em;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.confirm-choice-text {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    font-size: 1.2em;
    line-height: 1.6;
    color: #fff;
    text-align: center;
    border: 2px solid rgba(255, 215, 0, 0.3);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: keep-all;
}

.confirm-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.confirm-btn {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 15px 40px;
    font-size: 1.2em;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    min-width: 120px;
}

.confirm-btn:hover {
    background: linear-gradient(135deg, #5a6578 0%, #3d4758 100%);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
    border-color: #ffed4e;
}

.confirm-btn:active {
    transform: translateY(-1px);
}

/* 선택 확인 모달 반응형 */
@media (max-width: 768px) {
    .confirm-container {
        padding: 25px;
        max-width: 90%;
    }
    
    .confirm-container h2 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
    
    .confirm-choice-text {
        font-size: 1.1em;
        padding: 15px;
        min-height: 60px;
    }
    
    .confirm-btn {
        padding: 12px 30px;
        font-size: 1.1em;
        min-width: 100px;
    }
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

/* 캐릭터 카드 호버 애니메이션 강화 */
.character-card {
    animation: fadeInUp 0.6s ease;
}

.character-card:nth-child(1) {
    animation-delay: 0.1s;
}

.character-card:nth-child(2) {
    animation-delay: 0.2s;
}

.character-card:nth-child(3) {
    animation-delay: 0.3s;
}

/* 스토리 텍스트 타이핑 효과 */
.story-text {
    animation: fadeInUp 0.5s ease;
}

.restart-btn {
    margin-top: 30px;
    width: 100%;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: 2px solid #fff;
    border-radius: 12px;
    padding: 15px;
    font-size: 1.3em;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.restart-btn:hover {
    background: linear-gradient(135deg, #f74c3c 0%, #d0392b 100%);
    transform: scale(1.05);
}

/* 통계 그래프 스타일 */
.stats-graph-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    animation: fadeInUp 0.5s ease;
}

.stats-title {
    text-align: center;
    color: #ffd700;
    font-size: 1.8em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.stats-graph {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2em;
    color: #fff;
    font-weight: bold;
}

.stat-value {
    color: #ffd700;
    font-size: 1.3em;
    min-width: 50px;
    text-align: right;
}

.stat-bar-container {
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid rgba(255, 215, 0, 0.2);
    position: relative;
}

.stat-bar {
    height: 100%;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: width 1s ease;
}

.friendship-bar {
    background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
}

.courage-bar {
    background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
}

.knowledge-bar {
    background: linear-gradient(90deg, #f39c12 0%, #e67e22 100%);
}

.original-match-text-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    animation: fadeInUp 0.5s ease;
}

.original-match-text {
    margin: 0;
}

.match-percentage {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }
    
    h2 {
        font-size: 1.5em;
    }
    
    .part-cards {
        flex-direction: column;
        align-items: center;
    }
    
    .part-card {
        width: 100% !important;
        max-width: 300px !important;
        min-width: 200px !important;
        box-sizing: border-box !important;
    }
    
    .character-cards {
        flex-direction: column;
        align-items: center;
    }
    
    .character-card,
    button.character-card {
        width: 100% !important;
        max-width: 300px !important;
        min-width: 200px !important;
        flex: 0 0 auto !important;
        box-sizing: border-box !important;
        flex-direction: row !important;
        gap: 10px !important;
        padding: 15px !important;
    }
    
    .character-icon img {
        width: 100px !important;
        height: 100px !important;
    }
    
    .character-info-text h3 {
        font-size: 1.3em !important;
    }
    
    .character-info-text p {
        font-size: 0.9em !important;
    }
    
    .story-text {
        font-size: 1.1em;
    }
    
    .choice-btn {
        font-size: 1em;
        padding: 15px;
    }
    
    .character-info {
        font-size: 1em !important;
        gap: 8px !important;
    }
    
    #current-character-name {
        font-size: 1.3em !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    #current-character-icon {
        width: 35px !important;
        height: 35px !important;
        margin-right: 8px !important;
        flex-shrink: 0 !important;
    }
    
    .event-counter {
        font-size: 0.8em !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
}

