:root {
    --primary-color: #6a9eff;
    --secondary-color: #ff7eb9;
    --accent-color: #7afcff;
    --text-color: #333;
    --bg-color: #f8f9ff;
    --card-bg: #fff;
    --shadow-color: rgba(106, 158, 255, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
    background-image: radial-gradient(circle at 10% 20%, rgba(122, 252, 255, 0.05) 0%, rgba(122, 252, 255, 0.05) 90%), 
                      radial-gradient(circle at 90% 80%, rgba(255, 126, 185, 0.05) 0%, rgba(255, 126, 185, 0.05) 90%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease;
}

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

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px var(--shadow-color);
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.link-item {
    padding: 5px 5px 5px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.link-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--color, var(--primary-color));
}

.link-item:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 8px 25px var(--shadow-color);
}

.link-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--color, var(--primary-color));
    background: rgba(106, 158, 255, 0.1);
    border-radius: 50%;
    padding: 10px;
    transition: all 0.3s ease;
}

.link-item:hover .link-icon {
    transform: rotate(10deg) scale(1.1);
    background: rgba(106, 158, 255, 0.2);
}

.link-icon img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    object-fit: cover;
}

.link-name {
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
    width: 100%;
    color: var(--text-color);
}

.add-item {
    background: rgba(255, 255, 255, 0.7);
    border: 2px dashed var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.add-item:hover {
    background: rgba(106, 158, 255, 0.1);
    border-color: var(--secondary-color);
}

.add-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--primary-color);
    background: rgba(106, 158, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.add-item:hover .add-icon {
    color: var(--secondary-color);
    transform: scale(1.1);
}

.add-text {
    font-size: 14px;
    color: var(--primary-color);
    margin-top: 5px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.add-item:hover .add-text {
    color: var(--secondary-color);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border-top: 5px solid var(--primary-color);
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5px;
    border-radius: 0 0 15px 15px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 22px;
    font-weight: bold;
    color: var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 4px 10px var(--shadow-color);
    flex: 1;
    min-width: 120px;
}

button:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 126, 185, 0.3);
}

button.secondary {
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

button.secondary:hover {
    background: #f0f4ff;
}

button.danger {
    background: #ff4757;
}

button.danger:hover {
    background: #ff6b81;
    box-shadow: 0 6px 15px rgba(255, 107, 129, 0.3);
}

.action-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(106, 158, 255, 0.2);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--primary-color);
}

input[type="text"],
input[type="url"],
input[type="password"],
textarea,
input[type="color"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(106, 158, 255, 0.3);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: rgba(106, 158, 255, 0.05);
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
textarea:focus,
input[type="color"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(106, 158, 255, 0.2);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker input[type="color"] {
    width: 50px;
    height: 40px;
    padding: 2px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 12px;
    }
    
    .link-item, .add-item {
        padding: 12px;
        border-radius: 10px;
    }
    
    .link-icon, .add-icon {
        width: 45px;
        height: 45px;
        font-size: 24px;
    }
    
    .link-name, .add-text {
        font-size: 13px;
    }
    
    .modal-content {
        padding: 20px 15px;
    }
    
    button {
        min-width: 100%;
    }
}

/* 动画效果 */
.link-item {
    animation: cardAppear 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes cardAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}