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

body {
    font-family: 'Microsoft JhengHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

body::before {
    /* content: ''; */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.05"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.05"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.2);
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

h1 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 3em;
    font-weight: 700;
    letter-spacing: -1px;
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group:focus-within label {
    color: #667eea;
    transform: translateY(-2px);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

input, select {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
}

input:focus, select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

input::placeholder {
    color: #a0aec0;
    font-style: italic;
}

button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(-1px);
}

#loading {
    text-align: center;
    font-size: 18px;
    color: #667eea;
    margin: 30px 0;
    padding: 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    border: 2px dashed #667eea;
    animation: loadingPulse 1.5s ease-in-out infinite alternate;
}

@keyframes loadingPulse {
    from { 
        background: rgba(102, 126, 234, 0.1);
        border-color: #667eea;
    }
    to { 
        background: rgba(102, 126, 234, 0.2);
        border-color: #764ba2;
    }
}

#result {
    margin-top: 30px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    line-height: 1.6;
    max-height: 600px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    scrollbar-width: thin;
    scrollbar-color: #667eea #e2e8f0;
}

#result::-webkit-scrollbar {
    width: 8px;
}

#result::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 4px;
}

#result::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

#result::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

#error {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 8px 25px rgba(238, 90, 82, 0.3);
    animation: errorPulse 2s infinite;
}

@keyframes errorPulse {
    0% { box-shadow: 0 8px 25px rgba(238, 90, 82, 0.3); }
    50% { box-shadow: 0 8px 35px rgba(238, 90, 82, 0.5); }
    100% { box-shadow: 0 8px 25px rgba(238, 90, 82, 0.3); }
}

.hidden {
    display: none;
}

.lyrics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.lyrics-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.8em;
    font-weight: 700;
    margin: 0;
}

.download-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.download-btn {
    width: auto;
    padding: 12px 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.download-btn:hover::before {
    left: 100%;
}

.download-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.lyrics-content {
    white-space: pre-line;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    padding: 15px;
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.7);
    border: 1px solid #e2e8f0;
}

.lrc-line {
    padding: 2px 0;
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 3px;
}

.lrc-line:hover {
    background-color: #e9ecef;
    padding-left: 5px;
}

.lrc-line.current {
    color: #667eea;
    font-weight: bold;
    background-color: rgba(102, 126, 234, 0.1);
}

.text-lyrics {
    white-space: pre-wrap;
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    font-size: 18px;
    line-height: 2;
    text-align: center;
    padding: 20px;
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 2.2em;
        margin-bottom: 30px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    input, select {
        padding: 14px 16px;
        font-size: 16px; /* 防止iOS縮放 */
    }
    
    button {
        padding: 16px;
        font-size: 16px;
    }
    
    .switch-container {
        gap: 8px;
    }
    
    .switch-label {
        font-size: 13px;
    }
    
    .lyrics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .lyrics-title {
        font-size: 1.5em;
    }
    
    .download-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .download-btn {
        flex: 1;
        min-width: 120px;
        padding: 10px 15px;
        font-size: 13px;
    }
    
    #result {
        padding: 20px;
        max-height: 500px;
    }
    
    .text-lyrics, .lyrics-content {
        font-size: 16px;
        line-height: 1.7;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .download-buttons {
        flex-direction: column;
    }
    
    .download-btn {
        width: 100%;
        min-width: auto;
    }
    
    .switch-container {
        width: 100%;
    }
    
    .tooltip {
        width: 150px;
        left: auto;
        right: 0;
        transform: none;
    }
    
    .info-icon:hover + .tooltip {
        visibility: visible;
        opacity: 1;
    }
}

/* PNG导出样式 */
.png-export {
    position: absolute;
    left: -9999px;
    top: -9999px;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    padding: 50px;
    width: 700px;
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
    background-image: radial-gradient(circle, #667eea 1px, transparent 1px);
    background-size: 20px 20px;
}

.png-header {
    text-align: center;
    margin-bottom: 30px;
}

.png-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.png-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #667eea, #764ba2, transparent);
    width: 80%;
    margin: 0 auto;
}

.png-content {
    font-size: 18px;
    line-height: 2;
    color: #333;
    font-family: 'Courier New', monospace;
    text-align: center;
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.7);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.png-line {
    padding: 5px 0;
    transition: all 0.3s ease;
}

.png-lrc-line {
    font-weight: bold;
    color: #667eea;
}

.png-empty-line {
    height: 20px;
}

.png-footer {
    text-align: center;
    margin-top: 30px;
    color: #6c757d;
    font-size: 14px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-style: italic;
}

.checkbox-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.fuzzy-search-hint {
    font-size: 12px;
    color: #e53e3e;
    background-color: #fef2f2;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 4px solid #e53e3e;
    flex-basis: 100%;
    margin-top: 8px;
    font-style: italic;
}

.switch-group {
    margin-bottom: 25px;
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch-label {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: auto;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.info-container {
    position: relative;
    display: inline-block;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #e2e8f0;
    color: #718096;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    position: relative;
    transition: all 0.3s ease;
}

.info-icon:hover {
    background-color: #667eea;
    color: white;
}

.tooltip {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    font-weight: normal;
    font-style: italic;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.info-icon:hover + .tooltip {
    visibility: visible;
    opacity: 1;
}
