* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 15px;
    color: #333;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px 0;
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 5px;
}

.header p {
    font-size: 13px;
    color: #666;
}

.main-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.type-btn {
    flex: 1;
    min-width: 70px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    background: #fafafa;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    color: #666;
}

.type-btn.active {
    border-color: #1890ff;
    background: #e6f7ff;
    color: #1890ff;
}

.input-section {
    margin-bottom: 15px;
}

.input-section label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.textarea-wrapper {
    position: relative;
}

.textarea-wrapper textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s;
}

.textarea-wrapper textarea:focus {
    border-color: #1890ff;
    outline: none;
}

.char-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 11px;
    color: #999;
    background: rgba(255,255,255,0.9);
    padding: 2px 6px;
}

.input-section input,
.input-section select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 10px;
}

.input-section input:focus,
.input-section select:focus {
    border-color: #1890ff;
    outline: none;
}

.quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.quick-btn {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    background: #fafafa;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.quick-btn:active {
    background: #f0f0f0;
}

.style-section {
    background: #fafafa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.style-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 12px;
}

.style-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.style-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.style-item label {
    font-size: 12px;
    color: #666;
}

.style-item input[type="color"] {
    width: 100%;
    height: 36px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
}

.style-item select {
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.generate-btn {
    width: 100%;
    padding: 12px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.generate-btn:active {
    background: #096dd9;
}

.generate-btn:disabled {
    background: #d9d9d9;
    cursor: not-allowed;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show {
    display: flex;
}

.loading-box {
    background: white;
    padding: 25px 35px;
    border-radius: 8px;
    text-align: center;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f0f0f0;
    border-top-color: #1890ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.result-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    display: none;
}

.result-section.show {
    display: block;
}

.qrcode-container {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 15px;
    border: 1px solid #f0f0f0;
}

#qrcode-container {
    display: inline-block;
}

.result-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.result-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.download-btn {
    background: #52c41a;
    color: white;
}

.share-btn {
    background: #1890ff;
    color: white;
}

.regenerate-btn {
    background: #f0f0f0;
    color: #666;
}

.result-btn:active {
    opacity: 0.8;
}

.result-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.history-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    display: none;
}

.history-section.show {
    display: block;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-title {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.clear-history-btn {
    padding: 4px 10px;
    border: 1px solid #ff4d4f;
    background: transparent;
    color: #ff4d4f;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.history-item:hover {
    background: #fafafa;
}

.history-item:last-child {
    border-bottom: none;
}

.history-thumb {
    width: 45px;
    height: 45px;
    border-radius: 6px;
    object-fit: cover;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-text {
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.history-meta {
    font-size: 11px;
    color: #999;
}

.footer {
    text-align: center;
    padding: 20px 0;
    font-size: 12px;
    color: #999;
}

.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 20px;
    }

    .main-card {
        padding: 15px;
    }

    .style-grid {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
    }
}