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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 100%;
    text-align: center;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2.5rem;
    font-weight: 700;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.5;
}

.input-section {
    margin-bottom: 30px;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    resize: vertical;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

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

.input-options {
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.input-options label {
    color: #555;
    font-weight: 500;
}

.input-options select {
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.input-options select:focus {
    outline: none;
    border-color: #667eea;
}

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

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

/* 样式定制开关 */
.style-toggle-container {
    margin: 20px 0;
    text-align: center;
}

.style-toggle-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    color: #666;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.style-toggle-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
}

.style-toggle-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.toggle-icon {
    font-size: 16px;
}

.toggle-text {
    font-weight: 500;
}

.toggle-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.style-toggle-btn.active .toggle-arrow {
    transform: rotate(180deg);
}

.result-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.qr-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: inline-block;
}

#qrCanvas {
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.download-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.download-btn, .clear-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.download-btn {
    background: #28a745;
    color: white;
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

.clear-btn {
    background: #6c757d;
    color: white;
}

.clear-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.error-message {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 12px;
    margin-top: 20px;
    display: none;
    font-size: 14px;
}

.error-message.show {
    display: block;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 样式定制区域 */
.style-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin: 25px 0;
    text-align: left;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.style-section.expanded {
    max-height: 1000px;
    opacity: 1;
    margin: 25px 0;
}

.style-section h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3rem;
    text-align: center;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

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

.style-group:last-child {
    margin-bottom: 0;
}

.style-group h4 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* 颜色设置 */
.color-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

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

.color-input label {
    color: #666;
    font-weight: 500;
    min-width: 60px;
}

.color-input input[type="color"] {
    width: 50px;
    height: 35px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.preset-colors {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.preset-colors span {
    color: #666;
    font-weight: 500;
    margin-right: 5px;
}

.preset-color {
    width: 40px;
    height: 30px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    color: white;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-color:hover {
    transform: scale(1.1);
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 边框设置 */
.border-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.border-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.border-input label {
    color: #666;
    font-weight: 500;
    min-width: 80px;
}

.border-input input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.border-input input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: background 0.3s ease;
}

.border-input input[type="range"]::-webkit-slider-thumb:hover {
    background: #5a6fd8;
}

.border-input span {
    color: #333;
    font-weight: 600;
    min-width: 35px;
    text-align: right;
}

/* 高级设置 */
.advanced-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.select-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.select-input label {
    color: #666;
    font-weight: 500;
    min-width: 80px;
}

.select-input select {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.select-input select:focus {
    outline: none;
    border-color: #667eea;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 30px 20px;
        margin: 10px;
    }

    .style-section {
        padding: 20px 15px;
    }

    .color-options {
        grid-template-columns: 1fr;
    }

    .preset-colors {
        justify-content: center;
    }

    .preset-colors span {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .border-input, .select-input {
        flex-direction: column;
        align-items: flex-start;
    }

    .border-input label, .select-input label {
        min-width: auto;
    }

    .border-input input[type="range"] {
        width: 100%;
    }

    .select-input select {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 30px 20px;
        margin: 10px;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .input-options {
        flex-direction: column;
        gap: 8px;
    }

    .download-section {
        flex-direction: column;
        align-items: center;
    }

    .download-btn, .clear-btn {
        width: 100%;
        max-width: 200px;
    }
}