/* 슬라임 머지 타이쿤 - 스타일시트 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: 'Jua', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    touch-action: manipulation;
}

.container {
    width: 100%;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding: 10px;
    position: relative;
}

/* 헤더 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    margin-bottom: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.resource-display {
    display: flex;
    gap: 20px;
}

.resource {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    padding: 8px 15px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
    min-width: 100px;
}

.resource.jelly {
    color: #ffd166;
    border: 2px solid #ffd166;
}

.resource.diamond {
    color: #06d6a0;
    border: 2px solid #06d6a0;
}

.resource.xp {
    color: #ef476f;
    border: 2px solid #ef476f;
}

.resource i {
    font-size: 1.5rem;
}

.stage-info {
    text-align: center;
}

.stage {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: #118ab2;
}

.progress-bar {
    width: 200px;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #118ab2, #06d6a0);
    width: 10%;
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* 메인 게임 영역 */
.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.grid-container {
    flex: 1;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 15px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 5px;
    width: 100%;
    height: 100%;
}

.grid-cell {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.grid-cell:hover {
    background: rgba(255, 255, 255, 0.1);
}

.grid-cell.has-slime {
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.slime {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    animation: float 3s ease-in-out infinite;
}

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

.slime.fire { background: linear-gradient(135deg, #ff6b6b, #ff8e53); }
.slime.water { background: linear-gradient(135deg, #4cc9f0, #4361ee); }
.slime.earth { background: linear-gradient(135deg, #a8e6cf, #4caf50); }
.slime.thunder { background: linear-gradient(135deg, #ffd166, #ff9e00); }
.slime.plant { background: linear-gradient(135deg, #9b5de5, #00bbf9); }
.slime.poison { background: linear-gradient(135deg, #7209b7, #3a0ca3); }
.slime.light { background: linear-gradient(135deg, #fcf6bd, #ffe66d); }
.slime.dark { background: linear-gradient(135deg, #2b2d42, #6d6875); }

.slime-level {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.7rem;
    padding: 1px 4px;
    border-radius: 3px;
}

.grid-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* 컨트롤 패널 */
.control-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slime-shop h3 {
    margin-bottom: 10px;
    color: #06d6a0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.shop-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.shop-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
}

.shop-item.selected {
    border-color: #ffd166;
    background: rgba(255, 209, 102, 0.1);
}

.shop-item .slime-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 auto 5px;
}

.shop-item .price {
    font-size: 0.9rem;
    color: #ffd166;
    margin-top: 5px;
}

.shop-item .name {
    font-size: 0.8rem;
    opacity: 0.9;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.btn {
    padding: 12px;
    border: none;
    border-radius: 15px;
    font-family: 'Jua', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary {
    background: linear-gradient(135deg, #118ab2, #06d6a0);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #ff9e00, #ffd166);
    color: white;
}

.btn-tertiary {
    background: linear-gradient(135deg, #7209b7, #3a0ca3);
    color: white;
}

.btn-full {
    width: 100%;
    margin-top: 10px;
}

.btn-warning {
    background: linear-gradient(135deg, #ef476f, #ff6b6b);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 25px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 20px;
}

.upgrade-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.upgrade-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.upgrade-info {
    flex: 1;
}

.upgrade-name {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: #06d6a0;
}

.upgrade-desc {
    font-size: 0.9rem;
    opacity: 0.8;
}

.upgrade-price {
    color: #ffd166;
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 100px;
    text-align: right;
}

.upgrade-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upgrade-item.disabled .upgrade-price {
    color: #999;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 25px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #444;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 17px;
    width: 17px;
    left: 4px;
    bottom: 4px;
    background: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background: #06d6a0;
}

input:checked + .toggle-slider:before {
    transform: translateX(25px);
}

/* 토스트 메시지 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    z-index: 1001;
    display: none;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease;
}

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

.toast.show {
    display: block;
}

/* 파티클 */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: particleFloat 1s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) scale(0);
        opacity: 0;
    }
}

/* 반응형 */
@media (max-width: 768px) {
    .resource-display {
        gap: 10px;
    }
    
    .resource {
        min-width: 80px;
        font-size: 1rem;
        padding: 6px 10px;
    }
    
    .progress-bar {
        width: 150px;
    }
    
    .grid {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(10, 1fr);
    }
    
    .shop-items {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .action-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .resource-display {
        width: 100%;
        justify-content: space-around;
    }
    
    .progress-bar {
        width: 100%;
    }
    
    .grid {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(10, 1fr);
        gap: 3px;
    }
    
    .shop-items {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .btn {
        font-size: 0.9rem;
    }
}

/* 애니메이션 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease;
}

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

.pulse {
    animation: pulse 0.3s ease;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 255, 255, 0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.8); }
}

.glow {
    animation: glow 0.5s ease;
}