:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --background-color: #ecf0f1;
    --card-color: #ffffff;
    --text-color: #333333;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: #333333;
}

.container {
    flex: 1;
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}

header {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: 5px;
}

h1 {
    margin: 0;
    font-size: 2.5rem;
}

#content {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.column {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 10px;
    min-width: 0; /* 防止内容溢出 */
}

.column h2 {
    color: white;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

#tools, #ai-tools, #external-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--card-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.card h3 {
    color: var(--secondary-color);
    margin: 0;
    font-size: 1.2rem;
}

#external-links .card {
    text-decoration: none;
    color: inherit;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    overflow: auto;
}

.modal-content {
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: white;
    padding: 20px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    color: var(--secondary-color);
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--secondary-color);
}

#modal-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

#modal-body iframe {
    flex-grow: 1;
    border: none;
    min-height: 500px;
}

.tool-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tool-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.tool-form input,
.tool-form textarea {
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.tool-form input:focus,
.tool-form textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

.submit-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 1rem;
    font-weight: bold;
    align-self: center;
    margin-top: 1rem;
}

.submit-btn:hover {
    background-color: var(--secondary-color);
}

.tool-result {
    margin-top: 2rem;
    background-color: #ffffff;
    border-radius: 4px;
    padding: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.irr-calculator .tool-result {
    display: flex;
    justify-content: space-between;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-item span:first-child {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.pinyin-converter textarea {
    min-height: 100px;
    resize: vertical;
}

@media (max-width: 768px) {
    #content {
        flex-direction: column;
    }

    .card {
        min-height: 80px;
    }

    .modal-content {
        width: 95%;
        height: 90vh;
        margin: 5% auto;
    }

    #modal-body iframe {
        min-height: 500px;
    }

    .tool-container {
        max-width: 100%;
        padding: 15px;
    }

    .irr-calculator .tool-result {
        flex-direction: column;
        gap: 1rem;
    }

    .watermark-container {
        flex-direction: column;
    }

    .watermark-preview-section,
    .watermark-form-section {
        width: 100%;
        margin-bottom: 20px;
    }

    .preview-wrapper {
        min-height: 200px;
    }

    #previewImage {
        max-height: 200px;
    }

    .input-group input[type="text"],
    .input-group input[type="color"],
    .input-group input[type="range"] {
        width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .watermark-container {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .watermark-preview-section,
    .watermark-form-section {
        width: calc(50% - 10px);
    }
}

.clear-history {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.clear-history:hover {
    background-color: var(--secondary-color);
}

.image-watermark .preview {
    margin-top: 1rem;
    text-align: center;
}

.image-watermark .preview img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.download-btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 1rem;
}

.download-btn:hover {
    background-color: var(--secondary-color);
}

.watermark-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.watermark-title {
    text-align: center;
    color: white;
    font-size: 24px;
    margin-bottom: 20px;
}

.watermark-container {
    display: flex;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.watermark-preview-section, .watermark-form-section {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.preview-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

#previewImage {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.tool-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.input-group label {
    color: white;
    font-size: 16px;
    margin-bottom: 5px;
}

.input-group input[type="text"],
.input-group input[type="color"],
.input-group input[type="range"] {
    width: 100%;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 5px;
    box-sizing: border-box;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper input[type="file"] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

.file-input-wrapper .file-input-button {
    display: inline-block;
    padding: 8px 12px;
    background-color: #ffffff;
    color: #3498db;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.file-name {
    display: block;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 5px;
    font-size: 14px;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.submit-btn, .download-btn {
    background-color: #ffffff;
    color: #3498db;
    padding: 10px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    align-self: center;
    width: 100%;
    max-width: 200px;
}

.submit-btn:hover, .download-btn:hover {
    background-color: #f0f0f0;
}

.result-area {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    text-align: center;
}

#resultMessage {
    color: white;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .watermark-container {
        flex-direction: column;
    }

    .watermark-preview-section, .watermark-form-section {
        width: 100%;
    }

    .preview-wrapper {
        min-height: 200px;
    }

    #previewImage {
        max-height: 300px;
    }

    .input-group input[type="text"],
    .input-group input[type="color"],
    .input-group input[type="range"] {
        width: calc(100% - 16px);
        margin: 0 8px;
    }
}
