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

/* 고주사율 디스플레이 최적화 (120fps+ 지원) */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    padding: 15px;
    color: #fff;
    overflow-x: hidden;
}

/* 고성능 렌더링을 위한 GPU 가속 */
.nameplate,
.nameplate-glow,
.nameplate-aura,
.floating-particle,
.star,
.magpie {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.title {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 10px;
    padding-top: 10px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    background: linear-gradient(45deg, #ffd700, #ffed4e, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 2s ease-in-out infinite;
}

/* 이름표 + 미니 통계 wrapper */
.nameplate-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

/* 미니 통계 (이상기 카드 옆) */
.mini-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 70px;
}

.mini-label {
    font-size: 0.65rem;
    color: #aaa;
    font-weight: 500;
    margin-bottom: 2px;
}

.mini-value {
    font-size: 0.85rem;
    font-weight: 700;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes titleGlow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.3);
    }
}

/* 상태 표시 컨테이너 (골드 + 방지권) */
.status-display {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 100;
}

/* 보유 골드 표시 */
.gold-display {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    border-radius: 20px;
    box-shadow: 0 3px 12px rgba(243, 156, 18, 0.4);
    animation: goldPulse 2s ease-in-out infinite;
    transition: transform 0.2s ease;
}

.gold-display.increase {
    animation: goldIncrease 0.5s ease;
}

.gold-display.decrease {
    animation: goldDecrease 0.5s ease;
}

@keyframes goldIncrease {
    0% { transform: scale(1); }
    25% { transform: scale(1.1); background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%); }
    100% { transform: scale(1); }
}

@keyframes goldDecrease {
    0% { transform: scale(1); }
    25% { transform: scale(0.95); background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); }
    100% { transform: scale(1); }
}

/* 방지권 표시 */
.protection-display {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.protection-display:hover {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.6);
}

.protection-icon {
    font-size: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.protection-amount {
    font-size: 0.9rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    min-width: 50px;
    text-align: right;
}

.main-content {
    position: relative;
}

.gold-icon {
    font-size: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.gold-amount {
    font-size: 0.9rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    min-width: 50px;
    text-align: right;
    transition: all 0.1s ease;
}

@keyframes goldPulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(243, 156, 18, 0.6);
    }
}

.game-area {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.side-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 이름표 스타일 */
.nameplate-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.nameplate {
    position: relative;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 40px 55px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 4px solid #7f8c8d;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    overflow: hidden;
    cursor: pointer;
}

.nameplate:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6), 0 0 30px currentColor;
}

.nameplate:active {
    transform: translateY(-3px) scale(1.01);
}

/* 이상기 배경 이미지 오버레이 */
.nameplate-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.8s ease, background-image 0.5s ease;
    border-radius: 16px;
    z-index: 0;
    pointer-events: none;
    filter: blur(1px);
}

.nameplate-bg-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.3) 100%);
    border-radius: 16px;
}

/* 글로우 효과 - 레벨별 강화 */
.nameplate-glow {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, transparent, rgba(255, 215, 0, 0.5), transparent);
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    filter: blur(15px);
}

.nameplate.enhanced .nameplate-glow {
    opacity: 1;
    animation: glowPulse 2s ease-in-out infinite;
}

/* 레벨별 추가 효과 레이어 */
.nameplate.level-high .nameplate-glow {
    filter: blur(20px);
    box-shadow: 0 0 40px currentColor, 0 0 80px currentColor;
}

.nameplate.level-epic .nameplate-glow {
    filter: blur(25px);
    box-shadow: 0 0 50px currentColor, 0 0 100px currentColor, 0 0 150px currentColor;
}

.nameplate.level-legendary .nameplate-glow {
    filter: blur(30px);
    box-shadow: 0 0 60px currentColor, 0 0 120px currentColor, 0 0 180px currentColor;
    animation: glowPulse 1.5s ease-in-out infinite, glowRotate 4s linear infinite;
}

@keyframes glowRotate {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
        filter: blur(15px);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
        filter: blur(20px);
    }
}

/* 오라 효과 */
.nameplate-aura {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    animation: auraRotate 3s linear infinite;
    pointer-events: none;
}

.nameplate.enhanced .nameplate-aura {
    opacity: 1;
}

@keyframes auraRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1.1);
        opacity: 0.3;
    }
}

/* 떠다니는 파티클 */
.nameplate-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: 20px;
}

.floating-particle {
    position: absolute;
    width: 3px;
    height: 20px;
    background: linear-gradient(to top, transparent, #ffd700, transparent);
    border-radius: 50%;
    opacity: 0;
    animation: floatUp 3s ease-in-out infinite;
    box-shadow: 0 0 10px #ffd700, 0 0 20px #ffd700;
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) scale(1);
    }
}

/* 회전하는 테두리 - 기본 */
.nameplate::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(255, 255, 255, 0.5),
        rgba(255, 215, 0, 0.8),
        rgba(255, 255, 255, 0.5),
        transparent
    );
    border-radius: 20px;
    opacity: 0;
    z-index: -1;
    animation: borderRotate 3s linear infinite;
    filter: blur(4px);
}

.nameplate.enhanced::before {
    opacity: 1;
}

/* 고레벨 추가 회전 링 */
.nameplate.level-high::after,
.nameplate.level-epic::after,
.nameplate.level-legendary::after {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    right: -12px;
    bottom: -12px;
    background: conic-gradient(
        from 180deg,
        transparent,
        currentColor,
        transparent
    );
    border-radius: 25px;
    opacity: 0.6;
    z-index: -2;
    animation: borderRotate 2s linear infinite reverse;
    filter: blur(6px);
}

@keyframes borderRotate {
    0% {
        transform: rotate(0deg);
        filter: blur(4px);
    }
    50% {
        filter: blur(6px);
    }
    100% {
        transform: rotate(360deg);
        filter: blur(4px);
    }
}

/* 번개 효과 */
.nameplate::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    border-radius: 20px;
    opacity: 0;
    pointer-events: none;
    animation: lightning 4s ease-in-out infinite;
}

.nameplate.enhanced::after {
    opacity: 1;
}

@keyframes lightning {
    0%, 90%, 100% {
        opacity: 0;
        transform: translateX(-100%);
    }
    92% {
        opacity: 0.6;
        transform: translateX(100%);
    }
}

.nameplate-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.nameplate-level {
    font-size: 2rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 1), 0 0 30px rgba(255, 215, 0, 0.7);
    margin-bottom: 8px;
    animation: levelGlow 2s ease-in-out infinite;
}

@keyframes levelGlow {
    0%, 100% {
        text-shadow: 0 0 15px rgba(255, 215, 0, 1), 0 0 30px rgba(255, 215, 0, 0.7);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 25px rgba(255, 215, 0, 1), 0 0 50px rgba(255, 215, 0, 0.9), 0 0 70px rgba(255, 215, 0, 0.6);
        transform: scale(1.05);
    }
}

.nameplate-rank {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 3px;
    opacity: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 
                 0 0 20px currentColor,
                 0 0 30px currentColor;
    filter: drop-shadow(0 0 10px currentColor);
}

.nameplate-name {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7), 0 0 15px rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
    letter-spacing: 2px;
}

/* 별 스타일 */
.nameplate-stars {
    display: grid;
    grid-template-columns: repeat(8, auto);
    justify-content: center;
    align-items: center;
    gap: 4px;
    min-height: 60px;
    margin-top: 10px;
    max-width: 100%;
}

.star {
    font-size: 1.6rem;
    animation: starTwinkle 2s ease-in-out infinite;
    filter: drop-shadow(0 0 5px currentColor);
}

/* 첫 번째 줄 별 (1-8번) - 하단 마진 추가 */
.star:nth-child(-n+8) {
    margin-bottom: 5px;
}

/* 9번째 별부터 줄바꿈 */
.star:nth-child(9) {
    grid-column: 1;
}

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

.star:nth-child(3) {
    animation-delay: 0.4s;
}

.star:nth-child(4) {
    animation-delay: 0.6s;
}

.star:nth-child(5) {
    animation-delay: 0.8s;
}

.star:nth-child(6) {
    animation-delay: 1s;
}

.star:nth-child(7) {
    animation-delay: 1.2s;
}

.star:nth-child(8) {
    animation-delay: 1.4s;
}

.star:nth-child(9) {
    animation-delay: 1.6s;
}

.star:nth-child(10) {
    animation-delay: 1.8s;
}

.star:nth-child(11) {
    animation-delay: 2s;
}

.star:nth-child(12) {
    animation-delay: 2.2s;
}

.star:nth-child(13) {
    animation-delay: 2.4s;
}

.star:nth-child(14) {
    animation-delay: 2.6s;
}

.star:nth-child(15) {
    animation-delay: 2.8s;
}

@keyframes starTwinkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.15) rotate(180deg);
    }
}

/* 고레벨 별 추가 효과 */
.nameplate.level-epic .star,
.nameplate.level-legendary .star {
    animation: starTwinkle 1.5s ease-in-out infinite, starFloat 3s ease-in-out infinite;
}

/* 능력치 표시 (방지권 아래) */
.nameplate-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    backdrop-filter: blur(5px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
}

.stat-icon {
    font-size: 0.75rem;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.stat-value {
    font-size: 0.7rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    min-width: 28px;
}

@keyframes starFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.1);
    }
}

/* 강화 확률 표시 (카드 아래) */
.enhance-rates {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0 20px 0;
    padding: 18px 25px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.08) 100%);
    border-radius: 15px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2), inset 0 1px 3px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.rate-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    min-width: 90px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.rate-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.rate-label {
    font-size: 0.8rem;
    color: #ddd;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.rate-value {
    font-size: 1.5rem;
    font-weight: 900;
    text-shadow: 0 2px 10px currentColor, 0 0 15px currentColor;
}

.rate-item.success .rate-value {
    color: #4caf50;
}

.rate-item.destroy .rate-value {
    color: #f44336;
}

.rate-item.maintain .rate-value {
    color: #2196f3;
}

/* 버튼 */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-cost,
.btn-price {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-cost {
    color: #667eea;
}

.btn-price {
    color: #f1c40f;
}

.btn {
    padding: 20px;
    border: none;
    border-radius: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-enhance {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-enhance:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

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

.btn-enhance:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-sell {
    background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.btn-sell:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.6);
}

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

.btn-sell:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 우하단 버튼 컨테이너 (랭킹 + 까치) */
.fixed-buttons-corner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 9998;
}

/* 랭킹 버튼 */
.btn-ranking-fixed {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4), 0 0 20px rgba(243, 156, 18, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rankingPulse 2s ease-in-out infinite;
}

.btn-ranking-fixed:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(243, 156, 18, 0.6), 0 0 30px rgba(243, 156, 18, 0.4);
}

.btn-ranking-fixed:active {
    transform: scale(0.95);
}

@keyframes rankingPulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4), 0 0 20px rgba(243, 156, 18, 0.2);
    }
    50% {
        box-shadow: 0 4px 15px rgba(243, 156, 18, 0.6), 0 0 30px rgba(243, 156, 18, 0.4);
    }
}

/* 까치 버튼 */
.btn-magpie-fixed {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4), 0 0 20px rgba(46, 204, 113, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: magpiePulse 2s ease-in-out infinite;
}

.btn-magpie-fixed:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(46, 204, 113, 0.6), 0 0 30px rgba(46, 204, 113, 0.4);
}

.btn-magpie-fixed:active {
    transform: scale(0.95);
}

@keyframes magpiePulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4), 0 0 20px rgba(46, 204, 113, 0.2);
    }
    50% {
        box-shadow: 0 4px 15px rgba(46, 204, 113, 0.6), 0 0 30px rgba(46, 204, 113, 0.4);
    }
}

/* 정보 패널 */
.info-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.info-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-label {
    font-size: 0.8rem;
    color: #bbb;
    font-weight: 500;
}

.info-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.info-value.success-rate {
    color: #4caf50;
}

.info-value.destroy-rate {
    color: #f44336;
}

.info-value.maintain-rate {
    color: #2196f3;
}

.info-value.gold {
    color: #ffd700;
}

/* 로그 */
.log-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.log-header {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    font-weight: 700;
    font-size: 0.95rem;
}

.log-content {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
}

.log-content::-webkit-scrollbar {
    width: 6px;
}

.log-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.log-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.log-entry {
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.85rem;
    animation: logSlideIn 0.3s ease;
    line-height: 1.4;
}

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

.log-success {
    background: rgba(76, 175, 80, 0.2);
    border-left: 3px solid #4caf50;
    color: #4caf50;
}

.log-fail {
    background: rgba(244, 67, 54, 0.2);
    border-left: 3px solid #f44336;
    color: #f44336;
}

.log-info {
    background: rgba(33, 150, 243, 0.2);
    border-left: 3px solid #2196f3;
    color: #64b5f6;
}

.log-destroy {
    background: rgba(231, 76, 60, 0.3);
    border-left: 3px solid #e74c3c;
    color: #e74c3c;
    font-weight: 600;
}

/* 저장 버튼 (화면 왼쪽 위 고정) */
.save-button-fixed {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.6);
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.btn-save:active {
    transform: translateY(0);
}

.btn-save.saved {
    background: linear-gradient(135deg, #16a085 0%, #1abc9c 100%);
    animation: savePulse 0.5s ease;
}

@keyframes savePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.save-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.save-text {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.save-info {
    font-size: 0.75rem;
    color: #fff;
    padding: 6px 12px;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.save-info.show {
    opacity: 1;
}

.save-info.success {
    background: rgba(39, 174, 96, 0.8);
}

/* 초기화 버튼 (로그 컨테이너 아래) */
.btn-reset {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    margin-top: 10px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6);
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
}

.btn-reset:active {
    transform: translateY(0);
}

.reset-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.reset-text {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.log-destroy {
    background: rgba(156, 39, 176, 0.2);
    border-left: 3px solid #9c27b0;
    color: #ba68c8;
}



/* 아이템 상점 */
.shop-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 15px;
}

.shop-header {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    font-weight: 700;
    font-size: 0.95rem;
}

.shop-items {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shop-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.item-info {
    flex: 1;
}

.item-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.item-desc {
    font-size: 0.75rem;
    color: #bbb;
}

.btn-buy {
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.btn-buy:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.5);
}

.btn-buy:disabled {
    background: linear-gradient(135deg, #555 0%, #444 100%) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.5 !important;
    pointer-events: none;
}

.item-price::before {
    content: '💰 ';
}

/* 10개 묶음 구매 버튼 */
.btn-buy-bulk {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.btn-buy-bulk:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.5);
}

.btn-buy-bulk:disabled {
    background: linear-gradient(135deg, #555 0%, #444 100%) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.5 !important;
    pointer-events: none;
}

/* 과학 논문 구매 버튼 */
.btn-buy-paper {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

.btn-buy-paper:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.5);
}

/* 골드 부족 시 */
.btn-buy-paper:disabled:not(.purchased) {
    background: linear-gradient(135deg, #555 0%, #444 100%) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.5 !important;
    pointer-events: none;
}

/* 구매 완료 시 */
.btn-buy-paper.purchased {
    background: linear-gradient(135deg, #16a085 0%, #1abc9c 100%) !important;
    cursor: default !important;
    transform: none !important;
    box-shadow: 0 4px 15px rgba(26, 188, 156, 0.3) !important;
    opacity: 1 !important;
    pointer-events: none;
}

.btn-buy-paper.purchased .item-price {
    display: none;
}

.btn-buy-paper.purchased::after {
    content: '구매완료';
    color: white;
    font-weight: 700;
}

/* 고급 토글 스위치 컨테이너 */
.protection-toggle-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 5px;
}

.toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

/* 고급 토글 스위치 (크기 축소) */
.toggle-switch {
    position: relative;
    width: 60px;
    height: 28px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.toggle-switch:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4), 0 3px 10px rgba(0, 0, 0, 0.3);
}

.toggle-slider {
    position: absolute;
    left: 2px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.toggle-status {
    position: absolute;
    right: 8px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #95a5a6;
    transition: all 0.4s ease;
    z-index: 1;
}

/* 토글 활성화 상태 */
.toggle-switch.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2), 0 0 15px rgba(102, 126, 234, 0.4);
}

.toggle-switch.active .toggle-slider {
    left: calc(100% - 24px);
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.5), 0 0 12px rgba(255, 215, 0, 0.3);
}

.toggle-switch.active .toggle-status {
    right: auto;
    left: 8px;
    color: #fff;
}

/* 토글 스위치 글로우 효과 */
.toggle-switch.active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
    z-index: -1;
    opacity: 0.5;
    animation: toggleGlow 2s ease-in-out infinite;
}

@keyframes toggleGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* 까치 스타일 */
#magpieContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
}

.magpie {
    position: absolute;
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    will-change: transform;
}

.magpie.flipped .magpie-sprite {
    transform: scaleX(-1);
}

/* 까치가 flipped 상태일 때도 위치 유지 */
.magpie.flipped {
    /* transform은 JS에서 translate로 위치 설정, sprite만 반전 */
}

.magpie.flipped .diamond-halo,
.magpie.flipped .diamond-sparkle {
    transform: scaleX(-1);
}

/* 까치 도트 그래픽 - CSS로 생성 */
.magpie-sprite {
    position: relative;
    width: 48px;
    height: 48px;
}

.magpie-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 날개 펄럭임 애니메이션 - 프레임 전환 */
.frame-1 {
    opacity: 1;
    animation: wingFlap1 0.3s infinite;
}

.frame-2 {
    opacity: 0;
    animation: wingFlap2 0.3s infinite;
}

@keyframes wingFlap1 {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

@keyframes wingFlap2 {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

.pixel {
    position: absolute;
    width: 3px;
    height: 3px;
}

/* 까치 말풍선 */
.magpie-speech {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #333;
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: speechBounce 0.5s ease;
    z-index: 10;
}

/* 까치가 반전되더라도 말풍선은 정상 방향 유지 */
.magpie.flipped .magpie-speech {
    transform: translateX(-50%) scaleX(1);
}

.magpie-speech::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

@keyframes speechBounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* 반전된 까치의 말풍선 애니메이션 */
.magpie.flipped .magpie-speech {
    animation: speechBounceFlipped 0.5s ease;
}

@keyframes speechBounceFlipped {
    0%, 100% {
        transform: translateX(-50%) scaleX(1) translateY(0);
    }
    50% {
        transform: translateX(-50%) scaleX(1) translateY(-5px);
    }
}

/* 모바일 반응형 - 랭킹 & 까치 버튼 */
@media (max-width: 768px) {
    .fixed-buttons-corner {
        bottom: 15px;
        right: 15px;
        gap: 10px;
    }
    
    .btn-ranking-fixed,
    .btn-magpie-fixed {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .fixed-buttons-corner {
        bottom: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .btn-ranking-fixed,
    .btn-magpie-fixed {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* 파티클 캔버스 */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* 강화 애니메이션 - 연속 클릭 최적화 */
@keyframes enhanceSuccess {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.08);
        filter: brightness(1.5);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

@keyframes enhanceFail {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

@keyframes enhanceDestroy {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: brightness(1);
    }
    15% {
        transform: scale(1.05) rotate(-3deg);
        opacity: 0.9;
        filter: brightness(1.3) hue-rotate(0deg);
    }
    30% {
        transform: scale(0.95) rotate(3deg);
        opacity: 0.7;
        filter: brightness(0.8) hue-rotate(30deg);
    }
    45% {
        transform: scale(1.02) rotate(-2deg);
        opacity: 0.5;
        filter: brightness(0.5) hue-rotate(60deg);
    }
    60% {
        transform: scale(0.9) rotate(2deg);
        opacity: 0.3;
        filter: brightness(0.3) hue-rotate(90deg);
    }
    75% {
        transform: scale(0.85) rotate(0deg);
        opacity: 0.2;
        filter: brightness(0.2) hue-rotate(120deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: brightness(1);
    }
}

/* 파괴 시 깨지는 파편 효과 */
@keyframes shatter {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0.3) rotate(720deg);
    }
}

/* 애니메이션 클래스 - 연속 적용 지원 */
.nameplate.success {
    animation: enhanceSuccess 0.3s ease forwards;
}

.nameplate.fail {
    animation: enhanceFail 0.25s ease forwards;
}

.nameplate.destroy {
    animation: enhanceDestroy 0.6s ease forwards;
}

.nameplate.protection {
    animation: enhanceProtection 0.8s ease forwards;
}

/* 방지권 사용 애니메이션 */
@keyframes enhanceProtection {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    25% {
        transform: scale(1.08);
        filter: brightness(1.5) drop-shadow(0 0 20px gold);
    }
    50% {
        transform: scale(0.95);
        filter: brightness(1.3) drop-shadow(0 0 15px gold);
    }
    75% {
        transform: scale(1.05);
        filter: brightness(1.4) drop-shadow(0 0 25px gold);
    }
}

/* 파괴 효과 오버레이 */
.destroy-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(231, 76, 60, 0.3) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9998;
    animation: destroyFlash 0.6s ease;
}

@keyframes destroyFlash {
    0%, 100% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 방지권 사용 오버레이 */
.protection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, rgba(255, 237, 78, 0.15) 50%, transparent 100%);
    pointer-events: none;
    z-index: 9998;
    animation: protectionFlash 0.8s ease;
}

@keyframes protectionFlash {
    0%, 100% {
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    60% {
        opacity: 0.7;
    }
}

/* 방지권 방어막 효과 */
.protection-shield {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 3px solid rgba(255, 215, 0, 0.8);
    border-radius: 20px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 40px rgba(255, 215, 0, 0.4),
        inset 0 0 20px rgba(255, 215, 0, 0.3);
    animation: protectionShield 0.8s ease forwards;
    pointer-events: none;
}

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

/* 방지권 빔 효과 */
@keyframes protectionBeam {
    0% {
        opacity: 0;
        height: 0;
    }
    50% {
        opacity: 1;
        height: 200px;
    }
    100% {
        opacity: 0;
        height: 250px;
    }
}

/* 방지권 파티클 효과 */
@keyframes protectionParticle {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.3);
    }
}

/* 애니메이션 재시작을 위한 none 클래스 */
.nameplate.anim-none {
    animation: none !important;
}

/* 반응형 - 태블릿 */
@media (max-width: 1024px) {
    .container {
        max-width: 900px;
    }
    
    .game-area {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .main-content, .side-content {
        width: 100%;
    }
    
    .magpie {
        width: 40px;
        height: 40px;
    }
    
    .magpie-sprite {
        width: 40px;
        height: 40px;
    }
    
    .magpie-frame {
        width: 40px;
        height: 40px;
    }
}

/* 카드 확대 모달 오버레이 */
.card-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.card-modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 확대된 카드 컨테이너 */
.card-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.8);
    animation: zoomIn 0.3s ease forwards;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 확대된 카드 스타일 */
.nameplate.zoomed {
    padding: 70px 100px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.9), 0 0 150px currentColor;
    cursor: default;
    pointer-events: none;
    transform: scale(1.8);
}

.nameplate.zoomed .nameplate-level {
    font-size: 4rem;
}

.nameplate.zoomed .nameplate-rank {
    font-size: 2rem;
    letter-spacing: 6px;
}

.nameplate.zoomed .nameplate-name {
    font-size: 3rem;
}

.nameplate.zoomed .star {
    font-size: 3rem;
}

.nameplate.zoomed .nameplate-stars {
    gap: 8px;
}

/* 닫기 안내 텍스트 */
.close-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    animation: hintPulse 2s ease-in-out infinite;
    background: rgba(0, 0, 0, 0.5);
    padding: 12px 24px;
    border-radius: 25px;
}

/* ===== 닉네임 입력 모달 ===== */
.nickname-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10001;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nickname-modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease forwards;
}

.nickname-modal-content {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 35px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    max-width: 450px;
    width: 90%;
    text-align: center;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.nickname-modal-content h2 {
    color: #f1c40f;
    font-size: 1.8rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(241, 196, 15, 0.5);
}

.nickname-warning {
    color: #e74c3c;
    font-size: 0.95rem;
    margin-bottom: 25px;
    font-weight: 600;
    background: rgba(231, 76, 60, 0.1);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.nickname-modal-content input {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    margin-bottom: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.nickname-modal-content input:focus {
    outline: none;
    border-color: #f1c40f;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.3);
}

.nickname-buttons {
    display: flex;
    gap: 12px;
}

.btn-nickname-cancel,
.btn-nickname-confirm {
    flex: 1;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-nickname-cancel {
    background: linear-gradient(135deg, #7f8c8d 0%, #95a5a6 100%);
    color: white;
}

.btn-nickname-cancel:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 140, 141, 0.4);
}

.btn-nickname-confirm {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.btn-nickname-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.5);
}

/* ===== 랭킹 모달 ===== */
.ranking-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10001;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ranking-modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease forwards;
}

.ranking-modal-content {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    max-width: 800px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.ranking-header h2 {
    color: #f1c40f;
    font-size: 2rem;
    margin: 0;
    text-shadow: 0 2px 10px rgba(241, 196, 15, 0.5);
}

.btn-ranking-close {
    background: rgba(231, 76, 60, 0.8);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-ranking-close:hover {
    background: #e74c3c;
    transform: rotate(90deg);
}

.ranking-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-show-my-rank,
.btn-submit-rank {
    flex: 1;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.btn-show-my-rank {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.btn-show-my-rank:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

.btn-submit-rank {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.btn-submit-rank:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

.ranking-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.ranking-list::-webkit-scrollbar {
    width: 8px;
}

.ranking-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.ranking-list::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 10px;
}

.ranking-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.5);
}

.loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    padding: 40px;
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    transition: all 0.3s ease;
}

.rank-item:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 215, 0, 0.4);
    transform: translateX(5px);
}

.rank-item.my-rank {
    background: rgba(46, 204, 113, 0.15);
    border-color: rgba(46, 204, 113, 0.5);
    box-shadow: 0 4px 20px rgba(46, 204, 113, 0.2);
}

/* 1~3등 특별 스타일 */
.rank-item.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(218, 165, 32, 0.25) 100%);
    border: 2px solid #ffd700;
    box-shadow: 0 6px 30px rgba(255, 215, 0, 0.4);
}

.rank-item.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.25) 0%, rgba(169, 169, 169, 0.25) 100%);
    border: 2px solid #c0c0c0;
    box-shadow: 0 6px 30px rgba(192, 192, 192, 0.4);
}

.rank-item.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.25) 0%, rgba(184, 115, 51, 0.25) 100%);
    border: 2px solid #cd7f32;
    box-shadow: 0 6px 30px rgba(205, 127, 50, 0.4);
}

.rank-number {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 45px;
    text-align: center;
    color: #ecf0f1;
}

.rank-1 .rank-number {
    color: #ffd700;
    font-size: 1.8rem;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

.rank-2 .rank-number {
    color: #c0c0c0;
    font-size: 1.7rem;
    text-shadow: 0 0 15px rgba(192, 192, 192, 0.8);
}

.rank-3 .rank-number {
    color: #cd7f32;
    font-size: 1.6rem;
    text-shadow: 0 0 15px rgba(205, 127, 50, 0.8);
}

.rank-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rank-nickname-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rank-nickname {
    font-size: 1.2rem;
    font-weight: 600;
    color: #ecf0f1;
}

.rank-message {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    font-style: italic;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rank-level {
    font-size: 1rem;
    color: #f1c40f;
    font-weight: 600;
}

.rank-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    font-size: 0.85rem;
}

.rank-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.rank-stat-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    margin-bottom: 3px;
}

.rank-stat-value {
    color: #f39c12;
    font-weight: 600;
}

.empty-ranking {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
    padding: 60px 20px;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .ranking-modal-content {
        padding: 20px;
        max-height: 90vh;
    }
    
    .ranking-header h2 {
        font-size: 1.5rem;
    }
    
    .rank-item {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .rank-number {
        font-size: 1.2rem;
        min-width: 35px;
    }
    
    .rank-1 .rank-number {
        font-size: 1.5rem;
    }
    
    .rank-2 .rank-number {
        font-size: 1.4rem;
    }
    
    .rank-3 .rank-number {
        font-size: 1.3rem;
    }
    
    .rank-nickname {
        font-size: 1rem;
    }
    
    .rank-level {
        font-size: 0.9rem;
    }
    
    .rank-stats {
        gap: 5px;
        font-size: 0.75rem;
    }
    
    .rank-stat {
        padding: 4px;
    }
    
    .rank-message {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
    
    .nickname-modal-content {
        padding: 25px 30px;
    }
    
    .nickname-modal-content h2 {
        font-size: 1.5rem;
    }
}
    backdrop-filter: blur(5px);
}

@keyframes hintPulse {
    0%, 100% {
        opacity: 0.8;
        transform: translateX(-50%) translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(-5px);
    }
}

/* 반응형 - 모바일 */
@media (max-width: 768px) {
    .nameplate.zoomed {
        padding: 50px 70px;
        transform: scale(1.3);
    }
    
    .nameplate.zoomed .nameplate-level {
        font-size: 3rem;
    }
    
    .nameplate.zoomed .nameplate-rank {
        font-size: 1.5rem;
    }
    
    .nameplate.zoomed .nameplate-name {
        font-size: 2.2rem;
    }
    
    .nameplate.zoomed .star {
        font-size: 2.2rem;
    }
    
    .close-hint {
        font-size: 0.9rem;
        padding: 10px 20px;
        bottom: 20px;
    }
}

@media (max-width: 768px) {
    .title {
        font-size: 1.6rem;
        margin-bottom: 8px;
        padding-top: 5px;
    }
    
    /* 모바일 상태 표시 */
    .status-display {
        top: 8px;
        right: 8px;
        gap: 4px;
    }
    
    .gold-display {
        padding: 5px 10px;
    }
    
    .gold-icon {
        font-size: 0.85rem;
    }
    
    .gold-amount {
        font-size: 0.75rem;
        min-width: 45px;
    }
    
    .protection-display {
        padding: 5px 10px;
    }
    
    .protection-icon {
        font-size: 0.85rem;
    }
    
    .protection-amount {
        font-size: 0.75rem;
        min-width: 45px;
        text-align: right;
    }
    
    /* 모바일 토글 스위치 */
    .protection-toggle-container {
        padding: 10px 12px;
    }
    
    .toggle-label {
        font-size: 0.8rem;
    }
    
    .toggle-switch {
        width: 70px;
        height: 32px;
    }
    
    .toggle-slider {
        width: 24px;
        height: 24px;
    }
    
    .toggle-switch.active .toggle-slider {
        left: calc(100% - 27px);
    }
    
    .toggle-status {
        font-size: 0.6rem;
    }
    
    /* 모바일에서 미니 통계 */
    .nameplate-wrapper {
        flex-direction: column;
        gap: 15px;
        margin-top: 0;
        align-items: center;
    }
    
    .mini-stats {
        gap: 8px;
        margin-top: 0;
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }
    
    .mini-stat {
        padding: 5px 8px;
        min-width: 55px;
    }
    
    .mini-label {
        font-size: 0.55rem;
    }
    
    .mini-value {
        font-size: 0.75rem;
    }

    .game-area {
        padding: 15px;
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .main-content {
        gap: 12px;
    }
    
    /* 모바일 강화 확률 */
    .enhance-rates {
        gap: 10px;
        padding: 14px 18px;
        margin: 16px 0;
    }
    
    .rate-item {
        padding: 10px 14px;
        min-width: 75px;
    }
    
    .rate-label {
        font-size: 0.7rem;
    }
    
    .rate-value {
        font-size: 1.3rem;
    }

    .nameplate {
        padding: 18px 25px;
    }

    .nameplate-level {
        font-size: 1.4rem;
        margin-bottom: 4px;
    }
    
    .nameplate-rank {
        font-size: 0.8rem;
        margin-bottom: 4px;
    }
    
    /* 버튼 가격 표시 */
    .btn-cost,
    .btn-price {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    .nameplate-name {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }
    
    .nameplate-stars {
        min-height: 20px;
        margin-top: 5px;
    }
    
    .star {
        font-size: 1.2rem;
    }
    
    /* 모바일 능력치 표시 */
    .nameplate-stats {
        padding: 5px 8px;
        gap: 3px;
    }
    
    .stat-item {
        padding: 2px 4px;
    }
    
    .stat-icon {
        font-size: 0.65rem;
    }
    
    .stat-value {
        font-size: 0.6rem;
        min-width: 24px;
    }

    .info-panel {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .info-item {
        padding: 8px 6px;
    }
    
    .info-label {
        font-size: 0.65rem;
    }
    
    .info-value {
        font-size: 0.9rem;
    }

    .btn {
        padding: 12px;
        font-size: 1rem;
    }

    .log-content {
        max-height: 80px;
    }
    
    .log-entry {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    
    .shop-container {
        margin-top: 10px;
    }
    
    .shop-header {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .shop-items {
        padding: 8px;
        gap: 8px;
    }
    
    .item-name {
        font-size: 0.8rem;
    }
    
    .item-desc {
        font-size: 0.65rem;
    }
    
    .btn-buy {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    /* 768px에서 토글 관련 스타일은 이미 위에 정의됨 */
    
    .magpie {
        width: 42px;
        height: 42px;
    }
    
    .magpie-sprite {
        width: 42px;
        height: 42px;
    }
    
    .magpie-frame {
        width: 42px;
        height: 42px;
    }
    
    /* 모바일에서 픽셀 크기 증가 */
    .magpie .pixel {
        width: 2.5px;
        height: 2.5px;
    }
    
    .magpie-speech {
        font-size: 12px;
        padding: 6px 10px;
        top: -45px;
    }
    
    /* 모바일 저장 버튼 */
    .save-button-fixed {
        top: 10px;
        left: 10px;
        gap: 6px;
    }
    
    .btn-save {
        padding: 6px 12px;
        font-size: 0.8rem;
        gap: 5px;
    }
    
    .save-icon {
        font-size: 1rem;
    }
    
    .save-text {
        display: none;
    }
    
    .save-info {
        font-size: 0.7rem;
        padding: 5px 10px;
    }
    
    /* 모바일 초기화 버튼 */
    .btn-reset {
        padding: 10px 16px;
        font-size: 0.85rem;
        margin-top: 8px;
    }
    
    .reset-icon {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .title {
        font-size: 1.4rem;
        margin-bottom: 6px;
    }
    
    /* 초소형 상태 표시 */
    .status-display {
        top: 8px;
        right: 8px;
        gap: 5px;
    }
    
    .gold-display {
        padding: 4px 8px;
    }
    
    .gold-icon {
        font-size: 0.75rem;
    }
    
    .gold-amount {
        font-size: 0.7rem;
        min-width: 40px;
        padding-top: 2px;
    }
    
    .protection-display {
        padding: 4px 8px;
    }
    
    .protection-icon {
        font-size: 0.75rem;
    }
    
    .protection-amount {
        font-size: 0.7rem;
        min-width: 40px;
        text-align: right;
        padding-top: 2px;
    }
    
    /* 초소형 능력치 */
    .nameplate-stats {
        padding: 4px 6px;
        gap: 2px;
    }
    
    .stat-item {
        padding: 2px 3px;
    }
    
    .stat-icon {
        font-size: 0.6rem;
    }
    
    .stat-value {
        font-size: 0.55rem;
        min-width: 20px;
    }
    
    /* 초소형 토글 스위치 */
    .protection-toggle-container {
        padding: 6px 8px;
        gap: 8px;
        margin-bottom: 3px;
    }
    
    .toggle-label {
        font-size: 0.75rem;
        text-align: center;
    }
    
    .toggle-switch {
        width: 65px;
        height: 28px;
        margin: 0 auto;
    }
    
    .toggle-slider {
        width: 22px;
        height: 22px;
    }
    
    .toggle-switch.active .toggle-slider {
        left: calc(100% - 25px);
    }
    
    .toggle-status {
        font-size: 0.55rem;
    }
    
    /* 초소형 모바일에서 미니 통계 */
    .nameplate-wrapper {
        gap: 12px;
        margin-top: 0;
        flex-direction: column;
    }
    
    .mini-stats {
        margin-top: 0;
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }
    
    .mini-stat {
        padding: 4px 6px;
        min-width: 48px;
    }
    
    .mini-label {
        font-size: 0.5rem;
    }
    
    .mini-value {
        font-size: 0.7rem;
    }
    
    .game-area {
        padding: 10px;
        gap: 10px;
    }
    
    .main-content {
        gap: 10px;
    }
    
    .nameplate {
        padding: 15px 20px;
    }

    .nameplate-level {
        font-size: 1.2rem;
    }

    .nameplate-name {
        font-size: 1.4rem;
    }
    
    .nameplate-stars {
        gap: 3px;
        min-height: 50px;
    }
    
    .star {
        font-size: 1rem;
    }

    .info-panel {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    
    .info-item {
        padding: 6px 4px;
    }
    
    .info-label {
        font-size: 0.55rem;
    }

    .info-value {
        font-size: 0.8rem;
    }
    
    /* 초소형 강화 확률 */
    .enhance-rates {
        gap: 8px;
        padding: 12px 15px;
        margin: 14px 0;
    }
    
    .rate-item {
        padding: 8px 12px;
        min-width: 70px;
    }
    
    .rate-label {
        font-size: 0.65rem;
    }
    
    .rate-value {
        font-size: 1.2rem;
    }
    
    .button-group {
        gap: 8px;
    }
    
    .btn {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .log-container {
        max-height: 150px;
    }
    
    /* 초소형 저장 버튼 */
    .save-button-fixed {
        top: 8px;
        left: 8px;
        gap: 5px;
    }
    
    .btn-save {
        padding: 6px 10px;
        font-size: 0.75rem;
        gap: 4px;
    }
    
    .save-icon {
        font-size: 0.9rem;
    }
    
    .save-text {
        display: none;
    }
    
    .save-info {
        font-size: 0.65rem;
        padding: 4px 8px;
    }
    
    /* 초소형 초기화 버튼 */
    .btn-reset {
        padding: 8px 14px;
        font-size: 0.8rem;
        gap: 6px;
        margin-top: 8px;
    }
    
    .reset-icon {
        font-size: 0.95rem;
    }
    
    .reset-text {
        font-size: 0.75rem;
    }
    
    .shop-container {
        margin-top: 8px;
    }
    
    .shop-item {
        padding: 8px;
    }
    
    .magpie {
        width: 36px;
        height: 36px;
    }
    
    .magpie-sprite {
        width: 36px;
        height: 36px;
    }
    
    .magpie-frame {
        width: 36px;
        height: 36px;
    }
    
    /* 초소형에서 픽셀 크기 증가 */
    .magpie .pixel {
        width: 2.25px;
        height: 2.25px;
    }
    
    .magpie-speech {
        font-size: 11px;
        padding: 5px 8px;
        top: -40px;
    }
}
