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

:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f6fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 0.3rem;
    flex-wrap: nowrap;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.container {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-header h1 {
    font-size: 2rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.tool-header p {
    color: #7f8c8d;
    font-size: 1rem;
}

.tool-content {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.section-header span {
    font-weight: 600;
    color: var(--dark-color);
}

.input-section,
.output-section {
    margin-bottom: 1.5rem;
}

textarea {
    width: 100%;
    height: 200px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea[readonly] {
    background-color: #f8f9fa;
    cursor: default;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

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

.btn-secondary:hover {
    background-color: #27ae60;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-group-center {
    text-align: center;
    margin: 1.5rem 0;
}

.error-message {
    padding: 1rem;
    background-color: #fee;
    border: 1px solid var(--danger-color);
    border-radius: 6px;
    color: var(--danger-color);
    display: none;
    margin-top: 1rem;
}

.error-message.show {
    display: block;
}

.convert-section {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.status-message {
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
    margin: 1rem 0;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.info {
    background-color: #e8f4fd;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.status-message.error {
    background-color: #fee;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.info-box {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.info-box h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    padding: 0.5rem 0;
    color: #666;
    position: relative;
    padding-left: 1.5rem;
}

.info-box li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.help-content {
    max-width: 800px;
    margin: 0 auto;
}

.help-section {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.help-section h2 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.faq-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item h3 {
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.faq-item p {
    color: #666;
    line-height: 1.8;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.about-card h2 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.about-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.privacy-policy h4 {
    color: var(--dark-color);
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1rem;
}

.privacy-policy p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.privacy-policy ul {
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.privacy-policy ul li {
    color: #666;
    line-height: 1.8;
    margin-bottom: 0.25rem;
}

.privacy-policy .contact-info {
    margin-top: 1.5rem;
    font-weight: 500;
    color: var(--primary-color);
}

.privacy-policy .copyright {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: #999;
    font-size: 0.9rem;
}

.about-footer {
    text-align: center;
    padding: 1.5rem 0;
    color: #666;
    font-size: 0.9rem;
}

.about-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.about-footer a:hover {
    text-decoration: underline;
}

.team-note {
    margin-top: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.privacy-content {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.privacy-content h3 {
    color: var(--dark-color);
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.1rem;
}

.privacy-content p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.privacy-content ul {
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.privacy-content ul li {
    color: #666;
    line-height: 1.8;
    margin-bottom: 0.25rem;
}

.privacy-content .contact-info {
    margin-top: 1.5rem;
    font-weight: 500;
    color: var(--primary-color);
}

.privacy-content .copyright {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: #999;
    font-size: 0.9rem;
}

.version {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    padding: 0.5rem 0;
    color: #666;
    position: relative;
    padding-left: 1.5rem;
}

.feature-list li::before {
    content: '✓';
    color: var(--secondary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.upload-section {
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background-color: #f0f7fc;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-area p {
    color: #666;
    margin: 0.5rem 0;
}

.upload-hint {
    font-size: 0.85rem;
    color: #999;
}

.compress-result {
    margin-top: 1rem;
}

.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.preview-box {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
}

.preview-box h3 {
    text-align: center;
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.image-wrapper {
    background: white;
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    margin-bottom: 1rem;
}

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

.file-info {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-color);
}

.file-info .label {
    color: #666;
    font-size: 0.9rem;
}

.file-info .value {
    color: var(--dark-color);
    font-weight: 600;
}

.compression-ratio .value {
    color: var(--secondary-color);
}

.compress-controls {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
}

.slider-container {
    margin-bottom: 1.5rem;
}

.slider-container label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1rem;
}

.slider-container label span {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.slider-container input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    margin: 1rem 0;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #999;
}

.convert-options {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-item label {
    color: #666;
}

.format-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    min-width: 120px;
}

.format-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.option-item .output-format {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
}

.selected-files {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.selected-header h3 {
    color: var(--dark-color);
    font-size: 1rem;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.selected-item {
    background: white;
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.selected-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.selected-item-name {
    font-size: 0.7rem;
    color: #666;
    text-align: center;
    margin-top: 0.25rem;
    word-break: break-all;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#convertSelectedCount {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.2rem;
}

.convert-result {
    margin-top: 1.5rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.result-header h3 {
    color: var(--dark-color);
}

.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.convert-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-preview {
    background: white;
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

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

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    word-break: break-all;
    font-size: 0.9rem;
}

.item-size {
    font-size: 0.8rem;
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.info-box {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.info-box h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    padding: 0.5rem 0;
    color: #666;
    position: relative;
    padding-left: 1.5rem;
}

.info-box li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

footer {
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

footer p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.study-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.study-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.study-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.study-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}

.study-card p {
    color: #666;
    line-height: 1.6;
    flex: 1;
    margin-bottom: 1rem;
}

.study-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--secondary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    align-self: flex-start;
}

.article-content {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.article-content h2 {
    color: var(--dark-color);
    margin: 2rem 0 1rem 0;
    font-size: 1.4rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.article-content h2:first-child {
    margin-top: 0;
}

.article-content h3 {
    color: var(--primary-color);
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.1rem;
}

.article-content p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.article-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.article-content ul li {
    color: #666;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.code-block {
    background: #f5f5f5;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.code-block code {
    font-family: 'Courier New', monospace;
    color: #333;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.data-table th,
.data-table td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.data-table th {
    background: var(--primary-color);
    color: white;
}

.data-table td {
    background: white;
    color: #666;
}

.data-table tr:nth-child(even) td {
    background: #f9f9f9;
}

.article-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .container {
        padding: 1rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .btn-group {
        width: 100%;
    }

    .btn-group .btn {
        flex: 1;
        text-align: center;
    }

    textarea {
        height: 150px;
    }

    .preview-container {
        grid-template-columns: 1fr;
    }

    .upload-area {
        padding: 2rem 1rem;
    }
}
