* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    color: #333;
}

.container {
    position: relative;
    width: 320px;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

h1 {
    margin: 0 0 5px 0;
    font-size: 24px;
    color: #2c3e50;
    text-align: center;
}

.subtitle {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #7f8c8d;
    text-align: center;
}

.footer {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: #95a5a6;
    font-style: italic;
    width: 100%;
    padding: 10px 0;
    border-top: 1px dashed #ecf0f1;
}

.tissue-box {
    position: relative;
    width: 240px;
    height: 140px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.box-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background-color: #f0f0f0;
    border-bottom: 2px solid #ddd;
    border-radius: 8px 8px 0 0;
}

.opening {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 10px;
}

.box-front {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 110px;
    background: linear-gradient(to bottom, #ffffff, #f0f0f0);
    border-radius: 0 0 8px 8px;
}

.tissue-container {
    position: relative;
    width: 100%;
    height: 300px;
    margin-top: -20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 0;
}

.tissue {
    position: absolute;
    width: 80px;
    height: 60px;
    background-color: white;
    border: 1px solid #eee;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    cursor: grab;
    transition: transform 0.2s ease, top 0.2s ease;
    z-index: 2;
    will-change: transform, top, opacity;
    touch-action: none; /* 防止触摸设备上的默认行为 */
    user-select: none; /* 防止文本选择 */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.tissue.pulled {
    transform: translateY(100px);
    transition: transform 0.5s ease, top 0.5s ease;
}

.tissue.removing {
    pointer-events: none; /* 防止与正在移除的纸巾交互 */
}

.tissue.removed {
    transform: translateY(500px);
    opacity: 0;
    transition: transform 1s ease, opacity 1s ease, top 1s ease;
    pointer-events: none; /* 防止与已移除的纸巾交互 */
}

/* 禁用状态样式 */
button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 添加计数器动画 */
#tissueCount {
    transition: color 0.3s ease;
}

#tissueCount.updating {
    color: #e74c3c;
}

.controls {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

#tissueCount {
    font-size: 18px;
    color: #333;
}

/* 纸巾折叠效果 */
.tissue::before,
.tissue::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 10px;
    background-color: rgba(240, 240, 240, 0.8);
}

.tissue::before {
    top: 20px;
}

.tissue::after {
    top: 40px;
}

/* 响应式设计 */
@media (max-width: 400px) {
    .tissue-box {
        width: 200px;
        height: 120px;
    }
    
    .opening {
        width: 70px;
    }
    
    .tissue {
        width: 70px;
        height: 50px;
    }
}

/* 增强的按钮样式 */
button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:active, button.active {
    transform: translateY(1px);
    background-color: #3d8b40;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 禁用状态样式 */
button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

/* 按钮点击波纹效果 */
button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

button.active::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0) translate(-50%, -50%);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20) translate(-50%, -50%);
        opacity: 0;
    }
}

/* 计数器动画效果 */
#tissueCount {
    transition: all 0.3s ease;
}

#tissueCount.updating {
    color: #e74c3c;
    transform: scale(1.1);
}