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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    height: 100vh;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 900px;
    height: calc(100vh - 30px);
    background: rgba(255, 255, 255, 0.98);
    border-radius: 25px;
    padding: 20px 25px 20px 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    border: 3px dashed #667eea;
}

.header {
    text-align: center;
    margin-bottom: 15px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header h1 {
    font-size: 36px;
    color: #667eea;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 700;
}

.icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #ff6ec4 0%, #7873f5 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    animation: float 3s ease-in-out infinite;
    box-shadow: 0 5px 15px rgba(255, 110, 196, 0.4);
}

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

.stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.count {
    background: linear-gradient(135deg, #e0e7ff 0%, #cfe2ff 100%);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    color: #5a67d8;
    font-weight: 600;
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.count span {
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.clear-btn {
    background: linear-gradient(135deg, #a8edea 0%, #d5e5ff 100%);
    border: 2px solid #667eea;
    color: #5a67d8;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

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

.clear-btn:hover::before {
    width: 300px;
    height: 300px;
}

.clear-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

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

.generate-btn {
    background: linear-gradient(135deg, #d4b5f7 0%, #c5a3ff 100%);
    border: 2px solid #b794f6;
    color: #6b46c1;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

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

.generate-btn:hover::before {
    width: 300px;
    height: 300px;
}

.generate-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(183, 148, 246, 0.4);
}

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

.items-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    padding: 8px 8px 0 8px;
    align-content: flex-start;
}

/* 美化滚动条 - 默认隐藏，滚动时显示 */
.items-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
}

.items-container::-webkit-scrollbar {
    width: 6px;
}

.items-container::-webkit-scrollbar-track {
    background: transparent;
}

.items-container::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    transition: background 0.3s;
}

.items-container:hover::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.4);
}

.items-container::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.6);
}

.items-container::-webkit-scrollbar-thumb:active {
    background: rgba(102, 126, 234, 0.8);
}

.item {
    background: #f8f9fa;
    color: #6c757d;
    padding: 9px 18px;
    border-radius: 20px;
    border: 2px solid #e9ecef;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    line-height: 1.3;
    white-space: nowrap;
}

.item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #667eea;
}

.item.selected {
    background: linear-gradient(135deg, #fff0f7 0%, #ffe5f1 100%);
    color: #d6538d;
    border: 2px solid #ffd0e8;
    font-weight: 600;
    animation: pulse 0.5s ease;
    box-shadow: 0 3px 10px rgba(255, 105, 180, 0.12);
}

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

.item:active::before {
    width: 300px;
    height: 300px;
    transition: width 0s, height 0s;
}

/* 粒子效果 */
@keyframes sparkle {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(1) rotate(360deg);
    }
}

.sparkle {
    position: fixed;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #667eea 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: sparkle 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    z-index: 9999;
}

/* 页面加载动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeInUp 0.6s ease-out;
}

.item {
    animation: fadeInUp 0.4s ease-out backwards;
}

.item:nth-child(n) {
    animation-delay: calc(0.01s * var(--item-index));
}

/* 结果页面样式 */
.result-page {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #ffffff;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

.result-page.show {
    display: flex;
}

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

.result-image {
    max-width: 500px;
    width: 100%;
    height: auto;
    border-radius: 25px;
    margin-bottom: 30px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    animation: scaleIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.result-text {
    font-size: 28px;
    color: #000000;
    line-height: 1.8;
    margin: 0;
    font-weight: 700;
    text-align: center;
    animation: slideUp 0.6s ease 0.3s backwards;
    padding: 0 20px;
    letter-spacing: 1px;
}

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

/* 确认弹窗样式 */
.confirm-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.confirm-dialog.show {
    display: flex;
}

.confirm-content {
    background: white;
    padding: 35px 45px;
    border-radius: 25px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.confirm-title {
    font-size: 22px;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.confirm-message {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

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

.confirm-btn {
    padding: 10px 30px;
    border-radius: 20px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    border: none;
}

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

.confirm-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.confirm-no {
    background: #f0f0f0;
    color: #666;
}

.confirm-no:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px 18px;
        height: calc(100vh - 30px);
    }
    .item {
        font-size: 13px;
        padding: 8px 16px;
    }
    .items-container {
        gap: 8px;
    }
    .header h1 {
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px 15px;
    }
    .item {
        font-size: 12px;
        padding: 7px 14px;
    }
    .items-container {
        gap: 7px;
    }
    .header h1 {
        font-size: 28px;
    }
    .count, .clear-btn, .generate-btn {
        font-size: 11px;
        padding: 6px 14px;
    }
    .result-image {
        max-width: 320px;
    }
    .result-text {
        font-size: 22px;
    }
}

