:root {
    --primary-color: #4CAF50;
    --hover-color: #45a049;
    --error-color: #f44336;
    --bg-color: #f5f5f5;
    --code-bg: #2d2d2d;
    --text-color: #333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* 基础响应式设置 */
html, body {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 80px;
    box-sizing: border-box;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.header p {
    color: #666;
    font-size: 1.1em;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
        padding-bottom: 60px;
        width: 100%;
    }

    .header {
        margin-bottom: 15px;
        padding: 15px;
        width: 100%;
    }

    .header h1 {
        font-size: 24px;
    }

    .header p {
        font-size: 14px;
    }

    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 15px;
        width: 100%;
    }

    .code-section, .result-section {
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .code-editor {
        width: 100%;
        height: 300px;
        font-size: 12px;
        padding: 10px;
    }

    .button-container {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 5px;
        width: 100%;
    }

    .button {
        padding: 8px 12px;
        font-size: 12px;
        flex: 0 1 calc(50% - 5px);
        min-width: auto;
        justify-content: center;
    }

    .button i {
        font-size: 14px;
    }

    .examples {
        padding: 15px;
        gap: 10px;
        width: 100%;
    }

    .examples h3 {
        margin-bottom: 15px;
        width: 100%;
    }

    .example-buttons-container {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        width: 100%;
    }

    .example-button {
        margin: 0;
        padding: 8px 12px;
        font-size: 13px;
        flex: 0 1 calc(50% - 4px);
        min-width: 0;
    }

    .modal-content {
        padding: 10px;
        width: 95%;
        height: 95%;
    }

    .help-content {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    .help-sections section {
        padding: 10px;
    }

    .footer {
        padding: 10px;
        font-size: 12px;
        background-color: white;
    }

    .image-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .control-button {
        flex: 1 1 calc(50% - 5px);
        justify-content: center;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .button {
        flex: 1 1 100%;
        margin: 2px 0;
    }

    .example-button {
        flex: 0 1 calc(50% - 4px);
        font-size: 12px;
        padding: 6px 10px;
    }

    .header h1 {
        font-size: 20px;
    }

    .header p {
        font-size: 12px;
    }

    .code-editor {
        height: 250px;
        font-size: 11px;
    }

    .modal-content {
        width: 98%;
        padding: 5px;
    }
}

.code-section, .result-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.code-section h3, .result-section h3 {
    margin: 0;
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.1em;
}

.code-editor {
    width: 100%;
    height: 400px;
    padding: 15px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: var(--code-bg);
    color: #fff;
    resize: vertical;
}

.button-container {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.button {
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.3s ease;
    text-align: center;
}

.button i {
    margin: 0;
    flex-shrink: 0;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
}

.primary-button:hover {
    background-color: var(--hover-color);
}

.secondary-button {
    background-color: #fff;
    border: 1px solid #ddd;
    color: var(--text-color);
}

.secondary-button:hover {
    background-color: #f5f5f5;
}

.result-section {
    display: flex;
    flex-direction: column;
}

.result-image {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin-top: 10px;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.examples {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.examples h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.1em;
}

.example-buttons-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
}

.example-button {
    margin: 0;
    padding: 8px 15px;
    background-color: #e0e0e0;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.example-button:hover {
    background-color: #d0d0d0;
}

.error-message {
    color: var(--error-color);
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    display: none;
}

/* 添加全屏模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 1001;
    padding: 10px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.image-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.control-button {
    padding: 8px 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.3s ease;
    text-align: center;
}

.control-button:hover {
    background-color: #f5f5f5;
}

.control-button i {
    font-size: 18px;
}

.help-content {
    padding: 30px;
    max-width: 800px;
    margin: 0 auto;
}

.help-content h2 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
}

.help-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.help-sections section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.help-sections h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.help-sections ul {
    list-style-type: none;
    padding-left: 0;
}

.help-sections li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
}

.help-sections li:before {
    content: "•";
    color: #3498db;
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* 版权信息样式 */
.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
    border-top: 1px solid #eee;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}

.footer p {
    margin: 0;
}

.copy-tooltip {
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    animation: fadeInOut 2s ease-in-out;
    z-index: 1000;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, calc(-50% + 20px)); }
    15% { opacity: 1; transform: translate(-50%, -50%); }
    85% { opacity: 1; transform: translate(-50%, -50%); }
    100% { opacity: 0; transform: translate(-50%, calc(-50% - 20px)); }
}