:root {
    --main-pink: #FFA1C9;
    --sky-blue: #87CEEB;
    --mint-green: #98FB98;
    --deep-purple: #9370DB;
    --bg-blur: blur(12px);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(145deg, var(--sky-blue) 0%, var(--main-pink) 100%);
    min-height: 100vh;
    padding: 10px;
    position: relative;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

.anime-character {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    max-width: 250px;
    opacity: 0.9;
    display: none;
}

.widgets-container {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.widget-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: var(--bg-blur);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.main-container {
    position: relative;
    max-width: 800px;
    margin: 10px auto;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: var(--bg-blur);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.input-box {
    position: relative;
    margin: 20px 0;
    background: #fff;
    border-radius: 40px;
    box-shadow: 0 3px 12px rgba(255, 161, 201, 0.2);
    overflow: hidden;
}

#urlInput {
    width: 100%;
    padding: 14px 110px 14px 45px;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #6A5ACD;
    outline: none;
    box-sizing: border-box;
}

#urlInput::placeholder {
    color: #C8A2C8;
    font-size: 14px;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #C8A2C8;
    font-size: 18px;
}

.parse-btn {
    position: absolute;
    right: 4px;
    top: 4px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--deep-purple), var(--main-pink));
    color: white;
    border: none;
    border-radius: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.parse-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(106, 90, 205, 0.4);
}

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

.media-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.media-card:hover {
    transform: translateY(-3px);
}

.video-container {
    position: relative;
    padding-top: 56.25%;
    border-radius: 12px;
    overflow: hidden;
}

video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.bouncing-loader {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

.bouncing-loader div {
    width: 10px;
    height: 10px;
    margin: 3px;
    background: var(--deep-purple);
    border-radius: 50%;
    animation: bouncing 0.6s infinite alternate;
}

.bouncing-loader div:nth-child(2) {
    animation-delay: 0.2s;
}

.bouncing-loader div:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bouncing {
    to {
        transform: translateY(-10px);
    }
}

.debug-info {
    position: fixed;
    bottom: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    z-index: 9999;
    max-width: 90%;
}

.gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    aspect-ratio: 1;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.image-index {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(106, 90, 205, 0.9);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8em;
}

.download-btn, .download-all-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 25px;
    background: #FFA1C9;
    color: white;
    border-radius: 25px;
    text-decoration: none;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    margin: 5px;
}

.download-btn:hover, .download-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 161, 201, 0.4);
}

.cover-download-btn {
    background: #87CEEB !important;
}

.cover-download-btn:hover {
    box-shadow: 0 5px 15px rgba(135, 206, 235, 0.4);
}

@media (min-width: 768px) {
    .main-container {
        padding: 30px;
        margin: 20px auto;
    }

    #urlInput {
        font-size: 16px;
        padding: 16px 130px 16px 50px;
    }

    .parse-btn {
        padding: 12px 25px;
        font-size: 15px;
    }

    .anime-character {
        display: block;
    }
    
    .widgets-container {
        top: 20px;
        right: 20px;
    }
    
    .widget-card {
        padding: 10px 20px;
        font-size: 16px;
    }
}

/* 图片网格布局 */
.image-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-top: 15px;
}

/* 封面图片样式 */
.cover-image {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin: 10px 0;
}