@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700;900&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gold-gradient: linear-gradient(135deg, #f8d174 0%, #efb93a 50%, #f8d174 100%);
    --dark-bg: #1a1a2e;
    --light-text: #eee;
    --shadow-luxury: 0 8px 32px rgba(31, 38, 135, 0.37);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --border-glass: 1px solid rgba(255, 255, 255, 0.18);
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    padding: 2em;
    margin: 0;
    min-height: 100vh;
    --mouse-x: 50%;
    --mouse-y: 50%;
    --blob1-x: 20%;
    --blob1-y: 30%;
    --blob2-x: 80%;
    --blob2-y: 70%;
    background: 
        radial-gradient(circle at var(--mouse-x) var(--mouse-y), 
        rgba(50, 30, 70, 0.25) 0%, 
        rgba(30, 50, 80, 0.2) 20%, 
        rgba(60, 30, 60, 0.2) 40%, 
        rgba(40, 40, 70, 0.2) 60%, 
        rgba(20, 30, 50, 0.25) 80%, 
        rgba(0, 0, 0, 0.4) 100%),
        radial-gradient(ellipse at var(--blob1-x) var(--blob1-y),
        rgba(70, 40, 90, 0.15) 0%,
        transparent 70%),
        radial-gradient(ellipse at var(--blob2-x) var(--blob2-y),
        rgba(40, 60, 100, 0.15) 0%,
        transparent 70%),
        linear-gradient(135deg, 
        #0a0a0f 0%, #1a0f2a 25%, #0f0a20 50%, 
        #1a0a25 75%, #0a0a0f 100%);
    background-size: 150% 150%, 120% 120%, 130% 130%, 100% 100%;
    animation: curvedGradientShift 30s ease infinite;
    transition: --mouse-x 0s, --mouse-y 0s, --blob1-x 2s ease, --blob1-y 2s ease, --blob2-x 2s ease, --blob2-y 2s ease;
    color: var(--light-text);
    position: relative;
    overflow-x: hidden;
}


#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

a, button, .file-label, input[type="checkbox"], .image-item button {
    cursor: pointer;
}

@property --mouse-x {
    syntax: '<percentage>';
    initial-value: 50%;
    inherits: false;
}

@property --mouse-y {
    syntax: '<percentage>';
    initial-value: 50%;
    inherits: false;
}

@keyframes curvedGradientShift {
    0% { background-position: 0% 0%, 0% 0%; }
    25% { background-position: 100% 0%, 100% 0%; }
    50% { background-position: 100% 100%, 100% 100%; }
    75% { background-position: 0% 100%, 0% 100%; }
    100% { background-position: 0% 0%, 0% 0%; }
}

h1 {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    font-size: 4em;
    font-weight: 900;
    background: linear-gradient(
        45deg,
        #FFD700 0%,
        #FFED4E 10%,
        #FFD700 20%,
        #FFA500 30%,
        #FFD700 40%,
        #FFED4E 50%,
        #FFD700 60%,
        #FFA500 70%,
        #FFD700 80%,
        #FFED4E 90%,
        #FFD700 100%
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 2;
    text-align: center;
    margin-bottom: 0.8em;
    letter-spacing: 0.05em;
    animation: luxuryGradient 8s ease infinite, titleFloat 4s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
        line-height: 1.2;
    text-transform: uppercase;
}

h1::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse at center, 
        rgba(255, 215, 0, 0.5) 0%, 
        rgba(255, 165, 0, 0.3) 40%, 
        transparent 70%);
    filter: blur(20px);
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { 
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, #FFD700 50%, transparent 100%);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

@keyframes luxuryGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

@keyframes titleGlow {
    from { 
        text-shadow: 0 0 30px rgba(255, 107, 107, 0.5), 0 0 60px rgba(238, 90, 36, 0.3); 
        transform: scale(1);
    }
    to { 
        text-shadow: 0 0 50px rgba(255, 107, 107, 0.8), 0 0 80px rgba(238, 90, 36, 0.5), 0 0 100px rgba(255, 107, 107, 0.4); 
        transform: scale(1.02);
    }
}

p {
    font-weight: 300;
    line-height: 1.6;
    margin-bottom: 1.5em;
    text-align: center;
    position: relative;
    z-index: 2;
}

.subtitle {
    font-size: 1.3em;
    font-weight: 300;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(255, 215, 0, 0.6) 25%,
        rgba(255, 255, 255, 0.9) 50%,
        rgba(255, 215, 0, 0.6) 75%,
        rgba(255, 255, 255, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    margin-top: -0.8em;
    margin-bottom: 1em;
    position: relative;
    z-index: 1;
    letter-spacing: 0.15em;
    animation: subtitleShimmer 8s linear infinite;
    text-transform: uppercase;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
}

@keyframes subtitleShimmer {
    0% { 
        background-position: 0% 50%;
    }
    100% { 
        background-position: 200% 50%;
    }
}

.feature-text {
    font-size: 1.1em;
    color: #FFD700;
    margin-bottom: 2em;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-align: center;
    position: relative;
    z-index: 1;
    text-shadow: 
        0 0 30px rgba(255, 215, 0, 0.8),
        0 0 60px rgba(255, 215, 0, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.3);
    animation: goldPulse 2s ease-in-out infinite;
    padding: 0.5em 1.5em;
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0.1) 0%, 
        rgba(255, 215, 0, 0.05) 50%, 
        rgba(255, 215, 0, 0.1) 100%);
    border-radius: 30px;
    display: inline-block;
    border: 1px solid rgba(255, 215, 0, 0.3);
    backdrop-filter: blur(10px);
}

@keyframes goldPulse {
    0%, 100% { 
        opacity: 0.9;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.02);
    }
}

.dev-joke {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.5em;
    margin-bottom: 2em;
    font-weight: 300;
    letter-spacing: 0.05em;
    text-align: center;
    position: relative;
    z-index: 1;
    font-style: italic;
    transition: all 0.3s ease;
}

.dev-joke:hover {
    color: rgba(255, 215, 0, 0.7);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

#image-container {
    margin-top: 2em;
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2em;
    padding: 2em;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: var(--border-glass);
    box-shadow: var(--shadow-luxury);
    animation: fadeInUp 0.5s ease;
    position: relative;
    z-index: 2;
}

#image-container.has-images {
    display: grid;
}

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

#image-container img {
    max-width: 100%;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

#image-container img:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

#image-container a {
    position: relative;
    display: inline-block;
}

#image-container a::after {
    content: 'このページだけダウンロード';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

#image-container a::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    border: 8px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

#image-container a:hover::after,
#image-container a:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.page-range {
    margin: 2em auto;
    max-width: 600px;
    padding: 0;
    position: relative;
    z-index: 2;
    text-align: center;
}

.page-range input[type="number"] {
    width: 100px;
    padding: 10px 15px;
    margin: 0 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: var(--light-text);
    font-size: 16px;
    transition: all 0.3s ease;
}

.page-range input[type="number"]:focus {
    outline: none;
    border-color: #f8d174;
    box-shadow: 0 0 20px rgba(248, 209, 116, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

.page-range input[type="number"]::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
    font-weight: 300;
}

.checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5em;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 16px;
}

.checkbox-label:hover {
    color: #ff6b6b;
    transform: translateY(-1px);
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    width: 28px;
    height: 28px;
    margin-right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 15px rgba(255, 107, 107, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.checkbox-label input[type="checkbox"]:hover {
    border-color: #ff6b6b;
    box-shadow: 
        0 6px 20px rgba(255, 107, 107, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.checkbox-label input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-color: #ff6b6b;
    box-shadow: 
        0 6px 20px rgba(255, 107, 107, 0.5),
        0 0 0 2px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.file-input-section {
    margin: 2em auto;
    max-width: 600px;
    padding: 2em;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.05) 50%, 
        rgba(255, 215, 0, 0.05) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.37),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    overflow: hidden;
}

.file-input-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 215, 0, 0.2) 50%, 
        transparent 100%);
    animation: shimmer 3s infinite;
    pointer-events: none;
    transform: skewX(-20deg);
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

.file-input-section.drag-over {
    border: 2px dashed #f8d174;
    background: rgba(248, 209, 116, 0.1);
    transform: scale(1.02);
}

.drop-text {
    margin-top: 1em;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
}

#pdf-input {
    display: none;
}

#pdf-input + label,
.file-label {
    display: inline-block;
    padding: 15px 35px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 25px rgba(255, 107, 107, 0.4),
        0 0 0 2px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

#pdf-input + label::before,
.file-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

#pdf-input + label:hover,
.file-label:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 12px 35px rgba(255, 107, 107, 0.6),
        0 0 0 3px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, #ff7979 0%, #fd79a8 100%);
}

#pdf-input + label:hover::before,
.file-label:hover::before {
    left: 100%;
}

#pdf-input:disabled + label,
.file-label:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

#page-range-inputs {
    margin-top: 1em;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

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

#download-all {
    display: block;
    margin: 2em auto;
    padding: 21px 48px;
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 50%, #00d2ff 100%);
    background-origin: border-box;
    color: white;
    border: none;
    border-radius: 35px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 10px 30px rgba(0, 210, 255, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#download-all::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.8s;
}


#download-all:hover::before {
    left: 100%;
}

#download-all:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 
        0 15px 40px rgba(0, 210, 255, 0.6),
        inset 0 2px 0 rgba(255, 255, 255, 0.4);
    border-radius: 35px;
}

#download-all:hover:not(:disabled)::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #12c2e9 0%, #c471ed 50%, #f64f59 100%);
    border-radius: 37px;
    z-index: -1;
}

#download-all:active:not(:disabled) {
    transform: translateY(-2px) scale(1.01);
}

#download-all:disabled {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: 
        0 5px 15px rgba(108, 117, 125, 0.3),
        0 0 0 2px rgba(255, 255, 255, 0.1);
    transform: none;
}

#status {
    text-align: center;
    margin: 1em 0;
    font-weight: 400;
    color: #f8d174;
    min-height: 24px;
    position: relative;
    z-index: 2;
}

#progress-container {
    max-width: 600px;
    margin: 2em auto;
    padding: 0 2em;
    position: relative;
    z-index: 2;
}

#progress-bar {
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    overflow: hidden;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 2px 10px rgba(255, 215, 0, 0.2);
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
    background-size: 200% 100%;
    transition: width 0.3s ease;
    position: relative;
    border-radius: 20px;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    animation: goldShimmer 2s linear infinite;
}

@keyframes goldShimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

#progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: progressShine 1.5s linear infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.9em;
    text-shadow: 
        0 0 20px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(0, 0, 0, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.9),
        0 0 2px #000;
    z-index: 10;
    mix-blend-mode: normal;
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0.5);
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-gradient);
}

.copyright {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 18px;
    color: rgba(255, 215, 0, 0.7);
    font-weight: 300;
    z-index: 10;
    padding: 0.5em 1.2em;
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.4) 0%, 
        rgba(255, 215, 0, 0.1) 100%);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.copyright a {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
}

.copyright:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.4);
}

.copyright:hover a {
    color: rgba(255, 215, 0, 1);
}

@media (max-width: 768px) {
    body {
        padding: 1em;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .page-range,
    .file-input-section {
        padding: 1.5em;
    }
    
    #image-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1em;
        padding: 1em;
    }
    
    .copyright {
        bottom: 15px;
        right: 15px;
        font-size: 15px;
    }
}