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

body {
    font-family: "IBM Plex Sans", "Source Sans 3", "Noto Sans", "Helvetica Neue", sans-serif;
    background: #f6f7fb;
    min-height: 100vh;
    color: #1f2937;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 56px 24px 64px;
    position: relative;
}

.container.theme-home {
    --home-bg: #f5f7fb;
    --home-card: #ffffff;
    --home-border: #e5e7eb;
    --home-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    --home-text: #1f2937;
    --home-muted: #6b7280;
    --home-accent: #2563eb;
    --home-danger-bg: #fff5f5;
    --home-radius: 14px;
    background: transparent;
    color: var(--home-text);
}

.page-logo {
    position: absolute;
    top: -40px;
    left: -276px;
    height: 259px;
    width: auto;
    max-width: 864px;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

h1 {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--home-text);
    letter-spacing: -0.01em;
}

.subtitle {
    text-align: center;
    color: var(--home-muted);
    margin-bottom: 28px;
    font-size: 0.98rem;
    line-height: 1.6;
}

.tool-card {
    background: var(--home-card);
    border: 1px solid var(--home-border);
    border-radius: var(--home-radius);
    padding: 32px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    margin-bottom: 24px;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.12);
}

@media (prefers-reduced-motion: reduce) {
    .tool-card {
        transition: none;
    }

    .tool-card:hover {
        transform: none;
    }
}

.card-header {
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.15rem;
    color: var(--home-text);
    font-weight: 600;
    margin-bottom: 6px;
}

.card-subtitle {
    color: var(--home-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: var(--home-radius);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
    background: #f8fafc;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--home-accent);
    background: #eef2ff;
}

.upload-area.dragover {
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.16);
    transform: translateY(-2px) scale(1.01);
}

@media (prefers-reduced-motion: reduce) {
    .upload-area {
        transition: none;
    }

    .upload-area.dragover {
        transform: none;
    }
}

.upload-icon {
    color: #94a3b8;
    margin-bottom: 12px;
}

.upload-area:hover .upload-icon,
.upload-area.dragover .upload-icon {
    color: var(--home-accent);
}

.upload-text {
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--home-text);
    font-weight: 500;
}

.upload-formats {
    color: var(--home-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.file-info {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
}

.file-info.visible {
    display: flex;
}

.file-name {
    color: #1d4ed8;
    font-weight: 500;
    word-break: break-all;
}

.remove-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    transition: color 0.2s;
}

.remove-btn:hover {
    color: #dc2626;
}

.convert-btn {
    display: block;
    width: 100%;
    padding: 14px 22px;
    margin-top: 16px;
    background: var(--home-accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}

.convert-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.22);
    background: #1d4ed8;
}

.convert-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.convert-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.18);
    background: #1e40af;
}

.convert-btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-loading[hidden] {
    display: none;
}

.btn-text[hidden] {
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    text-align: center;
    display: none;
}

.message.visible {
    display: block;
}

.message.success {
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.message.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.info-section {
    margin-top: 32px;
    padding: 24px;
    background: var(--home-card);
    border-radius: var(--home-radius);
    border: 1px solid var(--home-border);
    box-shadow: var(--home-shadow);
}

.info-section h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--home-text);
    font-weight: 600;
}

.info-section ul {
    list-style: none;
}

.info-section li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.6;
}

.info-section li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--home-accent);
    border-radius: 50%;
}

.editor-link {
    display: inline-block;
    padding: 12px 24px;
    background: #0ea5e9;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.editor-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(14, 165, 233, 0.25);
}

.button-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.button-row .convert-btn {
    flex: 1;
    margin-top: 0;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal[hidden] {
    display: none;
}

.modal-content {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    min-width: 320px;
    max-width: 90%;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #111827;
    font-size: 1.2rem;
}

.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 0.9rem;
}

.form-row input[type="text"] {
    width: 100%;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #111827;
    font-size: 1rem;
    text-transform: uppercase;
}

.form-row input:focus {
    outline: none;
    border-color: #2563eb;
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #9ca3af;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.btn-secondary, .btn-primary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Wide modal for PDF page selector */
.modal-content-wide {
    min-width: 400px;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* PDF pages grid */
.pdf-pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.pdf-page-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.pdf-page-item:hover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.pdf-page-item.selected {
    border-color: #2563eb;
    background: #dbeafe;
}

.pdf-page-thumbnail {
    width: 100%;
    max-width: 100px;
    height: auto;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
}

.pdf-page-label {
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
}

.pdf-page-dims {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 2px;
}

/* Loading state for PDF */
.pdf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6b7280;
}

.pdf-loading .spinner {
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
    color: #2563eb;
}

@media (max-width: 640px) {
    .modal-content-wide {
        min-width: auto;
        max-width: 95%;
    }

    .pdf-pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
}

/* Bulk Convert Modal Styles */
.range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.page-input {
    width: 80px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #111827;
    font-size: 1rem;
    text-align: center;
}

.page-input:focus {
    outline: none;
    border-color: #2563eb;
}

.range-separator {
    color: #6b7280;
    font-weight: 500;
}

.range-total {
    color: #9ca3af;
    font-size: 0.9rem;
}

.bulk-preview {
    margin-top: 20px;
    padding: 14px 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    font-size: 0.9rem;
}

.preview-label {
    color: #0369a1;
    font-weight: 600;
    margin-right: 8px;
}

#bulkPreviewText {
    color: #0c4a6e;
    font-family: "Courier New", monospace;
}

#bulkConvertConfirm .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#bulkConvertConfirm .btn-loading[hidden] {
    display: none;
}

#bulkConvertConfirm .btn-text[hidden] {
    display: none;
}

#bulkConvertConfirm .spinner {
    width: 18px;
    height: 18px;
    animation: spin 1s linear infinite;
}

.notice-panel {
    margin-top: 20px;
    padding: 20px 22px;
    background: #fff7f7;
    border: 1px solid #f3c7c7;
    border-left: 4px solid #e9a6a6;
    border-radius: var(--home-radius);
}

.notice-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.notice-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #b15656;
    background: #fdeaea;
}

.notice-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 0;
    color: #9f4040;
}

.notice-panel ul {
    list-style: none;
}

.notice-panel li {
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.6;
}

.notice-panel li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d78b8b;
}

.notice-note {
    margin-top: 10px;
    color: var(--home-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.about-section p {
    color: #4b5563;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.text-link {
    color: var(--home-accent);
    text-decoration: none;
    font-weight: 600;
}

.text-link:hover {
    text-decoration: underline;
}

.site-footer {
    margin-top: 40px;
    padding: 24px 20px 32px;
    background: var(--home-card);
    border-top: 1px solid var(--home-border);
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
}

.footer-left {
    flex: 1 1 220px;
    color: var(--home-muted);
    font-size: 0.95rem;
}

.footer-links {
    flex: 1 1 180px;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-links a,
.footer-links button {
    color: var(--home-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.footer-links a:hover,
.footer-links button:hover {
    color: #1d4ed8;
}

.footer-contact {
    flex: 1 1 220px;
    text-align: right;
    color: var(--home-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.footer-about {
    max-width: 900px;
    margin: 12px auto 0;
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px solid var(--home-border);
    border-radius: var(--home-radius);
    color: #4b5563;
    font-size: 0.95rem;
}

.footer-about p + p {
    margin-top: 8px;
}

.steps {
    list-style: none;
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.steps li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #4b5563;
    font-size: 0.95rem;
}

.steps span {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .tool-card {
        padding: 24px;
    }

    .upload-area {
        padding: 28px 16px;
    }

    .button-row {
        flex-direction: column;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-links {
        justify-content: flex-start;
    }

    .footer-contact {
        text-align: left;
    }

    .page-logo {
        top: -34px;
        left: -180px;
        height: 173px;
        max-width: 576px;
    }
}
