/* Animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Reset and Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #27272a;
    background-color: #fafaf9;
    color-scheme: light only;
    min-height: 100vh;
}

/* Header */
.site-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid #e8e8e6;
    padding: 16px 0;
    margin-bottom: 40px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-title {
    font-size: 1.35rem;
    color: #18181b;
    letter-spacing: -0.03em;
    line-height: 1;
    font-weight: 600;
}

/* Main Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px;
}

.main-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Hero Area */
.hero-area {
    text-align: center;
    margin: 40px 0 28px;
    max-width: 780px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 16px;
}

.hero-title {
    font-size: 1.6rem;
    font-weight: 500;
    color: #18181b;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
    line-height: 1.4;
}

.hero-subtitle {
    font-size: 0.92rem;
    color: #71717a;
    line-height: 1.7;
    margin: 0;
    letter-spacing: 0.01em;
}

.hero-trust-line {
    margin-top: 12px;
    font-size: 0.82rem;
    color: #71717a;
    letter-spacing: 0.04em;
}

@media (max-width: 640px) {
    .hero-title { font-size: 1.3rem; line-height: 1.45; margin-bottom: 8px; }
    .hero-subtitle { font-size: 0.82rem; line-height: 1.7; }
    .hero-area { margin: 24px auto 20px; }
    .hero-trust-line { font-size: 0.75rem; }
}

.hero-description {
    font-size: 1.1rem;
    color: #52525b;
    line-height: 1.7;
}

.hero-description strong {
    color: #18181b;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #ffffff;
    color: #3f3f46;
    padding: 8px 16px;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid #e4e4e7;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.hero-badge:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.02);
    transform: translateY(-1px);
}

.hero-badge svg {
    color: #52525b;
}

/* Modal Overlay for Preview */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85); /* Dark slate background */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.modal-overlay > .modal-content {
    background: #fff;
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 98vw;
    max-height: 95vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    transform: scale(1);
    transition: transform 0.2s ease-in-out;
}
.modal-overlay.hidden .modal-content {
    transform: scale(0.95);
}
.modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 34px;
    height: 34px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #ef4444;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    z-index: 10;
    border: 1px solid #e4e4e7;
}
.modal-close:hover {
    background: #fef2f2;
}
.modal-image-container {
    overflow: auto;
    max-height: calc(95vh - 70px); /* Leave room for text */
    display: flex;
    justify-content: center;
    border-radius: 8px;
    background: #fafaf9 url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+CjxyZWN0IHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2ZmZiIgLz4KPHBhdGggZD0iTTAgMTBoMjBNMTAgMHYyMCIgc3Ryb2tlPSIjZTNlOGVmIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIC8+Cjwvc3ZnPg==') repeat;
}
.modal-image-container img {
    /* 螳滄圀縺ｮ蛻ｩ逕ｨ繧ｵ繧､繧ｺ縺ｫ霑代＞蠖｢縺ｧ陦ｨ遉ｺ縲ゅ◆縺縺礼判髱｢縺九ｉ縺ｯ縺ｿ蜃ｺ縺輔↑縺・ｨ句ｺｦ縺ｫ隱ｿ謨ｴ */
    max-width: 100%;
    height: auto;
    display: block;
}
.modal-info {
    margin-top: 6px;
    text-align: center;
    font-size: 0.9rem;
    color: #3f3f46;
}

/* Notice Box / Security Badge */
.notice-box {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    border-left: 4px solid #a1a1aa;
    border-radius: 0 8px 8px 0;
    padding: 16px 20px;
    margin-bottom: 30px;
    font-size: 0.95rem;
    color: #27272a;
}

.notice-box strong {
    color: #18181b;
}

/* Converter Area */
.converter-area {
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 40px;
}

/* Drop Zone */
.drop-zone {
    border: 1.5px solid #d4d4d8;
    border-radius: 10px;
    background-color: #fafaf9;
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.drop-zone:hover:not(.busy) {
    background-color: #f4f4f5;
    border-color: #a1a1aa;
}

.drop-zone.dragover:not(.busy) {
    background-color: #f4f4f5;
    border-color: #18181b;
    border-style: solid;
    transition: none;
}

.drop-zone.busy {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f4f4f5;
    border-color: #d4d4d8;
    pointer-events: none;
}

/* Hero drop zone: dominant first-view element */
.drop-zone-hero {
    position: relative;
    min-height: 50vh;
    padding: 40px 24px 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-width: 1.5px;
    border-radius: 10px;
    background: #fafaf9;
    transition: min-height 0.35s ease, padding 0.35s ease;
}

/* After first drop, shrink so the controls below come into view */
.converter-area:has(> .controls:not(.hidden)) .drop-zone-hero {
    min-height: 0;
    padding: 24px 20px 40px;
}

.converter-area:has(> .controls:not(.hidden)) .drop-zone-hero .drop-zone-icon-wrap {
    width: 56px;
    height: 56px;
    margin-bottom: 12px;
}

.converter-area:has(> .controls:not(.hidden)) ~ .scroll-hint {
    display: none;
}

@media (max-width: 640px) {
    .drop-zone-hero { min-height: 44vh; padding: 32px 16px 48px; }
}

.drop-zone-hero .drop-zone-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: #a1a1aa;
}

.drop-zone-headline {
    font-size: 1rem;
    font-weight: 500;
    color: #27272a;
    margin: 0 0 4px;
}

.drop-zone-hero .sub-text {
    font-size: 0.85rem;
    color: #a1a1aa;
    margin: 0;
}

.drop-zone-formats {
    font-size: 0.75rem;
    font-weight: 400;
    color: #a1a1aa;
    margin: 12px 0 0 0;
    letter-spacing: 0.02em;
}

.drop-zone-folder-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: #a1a1aa;
    margin: 4px 0 0 0;
}

.drop-zone-safety {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #71717a;
    margin-top: 10px;
    white-space: nowrap;
}

.drop-zone-safety svg { color: #52525b; flex-shrink: 0; }
.drop-zone-safety a { color: #52525b; text-decoration: underline; }

@media (max-width: 640px) {
    .drop-zone-safety { font-size: 0.7rem; white-space: normal; text-align: center; line-height: 1.4; }
}

/* Hold-to-compare badge inside modal */
#compare-badge {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(15, 23, 42, 0.85);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 20;
    white-space: nowrap;
}

#compare-badge.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#modal-img-converted:active { cursor: grabbing; }

/* Scroll hint between hero and below-the-fold content */
.scroll-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 24px auto 28px;
    font-size: 0.72rem;
    color: #a1a1aa;
    letter-spacing: 0.06em;
    animation: scroll-hint-bob 2.4s ease-in-out infinite;
}

@keyframes scroll-hint-bob {
    0%, 100% { transform: translateY(0); opacity: 0.85; }
    50% { transform: translateY(3px); opacity: 1; }
}

/* Drag guide: both zones pulse when files are dragged onto the page */
@keyframes drag-guide-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(24, 24, 27, 0.12); }
    50% { box-shadow: 0 0 0 4px rgba(24, 24, 27, 0.06); }
}

.drag-guide-active:not(.busy) {
    border-color: #18181b !important;
    background-color: #f4f4f5 !important;
    animation: drag-guide-pulse 1.5s ease-in-out infinite;
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

.drop-zone p {
    font-weight: 500;
    color: #27272a;
    margin-bottom: 5px;
    font-size: 1rem;
}

.drop-zone .sub-text {
    font-size: 0.9rem;
    font-weight: normal;
    color: #71717a;
}

/* Controls */
.controls {
    margin-top: 35px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
}

.preview-area, .settings-area {
    width: 100%;
    max-width: 800px;
}

.hidden {
    display: none !important;
}

/* Content Area for SEO & Information */
.content-area {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.content-box {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e4e4e7;
}

.content-box h2 {
    font-size: 1.4rem;
    color: #27272a;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e4e4e7;
}

.content-box h3 {
    font-size: 1.1rem;
    color: #3f3f46;
    margin-top: 25px;
    margin-bottom: 10px;
}

.content-box p {
    font-size: 0.95rem;
    color: #52525b;
    line-height: 1.7;
    margin-bottom: 15px;
}

.usage-list {
    padding-left: 20px;
    color: #52525b;
    font-size: 0.95rem;
    line-height: 1.8;
}

.usage-list li {
    margin-bottom: 10px;
}

.faq-list dt {
    font-weight: 600;
    color: #3f3f46;
    margin-top: 20px;
    margin-bottom: 8px;
    font-size: 1rem;
}

.faq-list dd {
    color: #52525b;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-left: 0;
    padding-left: 20px;
    border-left: 3px solid #d4d4d8;
}


/* File List Area */
.preview-area {
    flex: 1;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
}

.area-title-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e4e4e7;
    margin-bottom: 8px;
    padding-bottom: 8px;
}

.area-title {
    font-size: 0.95rem;
    color: #3f3f46;
    font-weight: 500;
    margin: 0;
}

.clear-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.file-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.file-item {
    font-size: 0.8rem;
    padding: 6px 5px;
    border-bottom: 1px solid #e4e4e7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #52525b;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item-office-images {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
}

.file-item-office-images li {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 0 3px 12px;
    font-size: 0.75rem;
    color: #71717a;
}

.file-item-office-images li input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #18181b;
    cursor: pointer;
    flex-shrink: 0;
}

.file-item-office-images li label {
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-office-images li.skipped label {
    text-decoration: line-through;
    color: #a1a1aa;
}

/* Settings */
.settings-area {
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #3f3f46;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: #fff;
    color: #3f3f46;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #18181b;
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}

.form-control-range {
    width: 100%;
    margin-top: 5px;
    accent-color: #18181b;
}

.disabled-group {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(100%);
}

/* Quality Stepper */
.stepper-wrap {
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: #fafaf9;
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.stepper-btn {
    flex: 1;
    padding: 8px;
    background: #f4f4f5;
    border: none;
    font-size: 1.2rem;
    color: #52525b;
    font-weight: 900;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.stepper-btn:hover {
    background: #e4e4e7;
}

.stepper-btn:active {
    background: #d4d4d8;
}

.stepper-value {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #27272a;
    border-left: 1px solid #d4d4d8;
    border-right: 1px solid #d4d4d8;
    background: #ffffff;
}

.stepper-unit {
    font-size: 0.9rem;
    color: #71717a;
    margin-left: 2px;
    font-weight: 600;
}

.quality-presets {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.preset-btn {
    flex: 1;
    padding: 12px 4px;
    background-color: #ffffff;
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    color: #71717a;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background-color: #f4f4f5;
    border-color: #a1a1aa;
    color: #3f3f46;
}

.preset-btn.active {
    background-color: #18181b;
    border-color: #18181b;
    color: #ffffff;
}



.drop-zone .sub-text {
    font-size: 0.95rem;
    color: #71717a;
    margin-bottom: 0;
}

.drop-zone .format-text {
    font-size: 0.8rem;
    color: #a1a1aa;
    margin-top: 8px;
    margin-bottom: 0;
}

.help-text {
    font-size: 0.8rem;
    color: #71717a;
    margin-top: 6px;
}

.pro-tip {
    margin-top: 12px;
    padding: 12px 15px;
    background-color: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: 4px 8px 8px 4px;
    font-size: 0.85rem;
    color: #92400e;
    line-height: 1.5;
}

.pro-tip strong {
    color: #b45309;
}

/* Buttons - Vibrant Gradient */
.btn-primary {
    display: block;
    width: 100%;
    padding: 15px;
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background: #27272a;
    transform: translateY(-1px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

.btn-primary:disabled {
    background: #a1a1aa;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
.btn-primary.cancel-mode {
    background: #a1a1aa;
}
.btn-primary.cancel-mode:hover {
    background: #71717a;
}

/* Result Summary */
@keyframes popIn {
    0% { opacity: 0; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

.result-summary {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fafafa;
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    color: #27272a;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-summary.warning {
    background: #fffbeb;
    border-color: #fbbf24;
    color: #78350f;
}

.bug-modal-title {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 10px;
    color: #27272a;
}

/* Modern Accordion */
.modern-accordion {
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}
.modern-accordion:hover {
    border-color: #d4d4d8;
}
.modern-accordion summary {
    padding: 20px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modern-accordion summary::-webkit-details-marker {
    display: none;
}
.modern-accordion summary h2 {
    margin: 0;
    font-size: 1.05rem;
    color: #27272a;
    border-bottom: none;
    padding-bottom: 0;
    font-weight: 500;
}
.modern-accordion summary::after {
    content: '+';
    font-size: 1.5rem;
    color: #71717a;
    font-weight: 300;
    line-height: 1;
}
.modern-accordion[open] summary::after {
    content: '竏・;
}
.modern-accordion .accordion-body {
    padding: 0 20px 20px;
    color: #52525b;
    font-size: 0.95rem;
}
.modern-accordion .accordion-body h3 {
    font-size: 1.05rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #27272a;
}
.modern-accordion .accordion-body p {
    margin-bottom: 12px;
}
.modern-accordion .accordion-body dt {
    font-weight: 500;
    color: #27272a;
    margin-top: 15px;
    margin-bottom: 5px;
}
.modern-accordion .accordion-body dd {
    margin-left: 0;
    padding-left: 15px;
    border-left: 3px solid #e4e4e7;
    margin-bottom: 15px;
    color: #52525b;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.result-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #18181b;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.result-stats {
    font-size: 0.95rem;
    font-weight: 600;
    color: #27272a;
    background: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #d4d4d8;
    white-space: nowrap;
}

.result-saved {
    font-size: 0.9rem;
    color: #3f3f46;
    margin-left: auto;
}

.result-saved strong {
    font-size: 1rem;
    color: #18181b;
    font-weight: 600;
}

.result-summary.warning .result-title {
    color: #b45309;
}

.result-summary.warning .result-stats {
    color: #92400e;
    border-color: #fcd34d;
}

.result-summary.warning .result-saved {
    color: #78350f;
}

.result-summary.warning .result-saved strong {
    color: #d97706;
}

/* Modal Nav Buttons (fixed position) */
.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-nav-btn:hover {
    background: rgba(0, 0, 0, 0.75);
}

.modal-nav-btn.prev {
    left: 8px;
}

.modal-nav-btn.next {
    right: 8px;
}

/* Skip Compress Checkbox */
.skip-compress-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
    padding: 6px 12px;
    background: #fafaf9;
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #3f3f46;
    cursor: pointer;
    transition: background 0.15s;
}

.skip-compress-wrap:hover {
    background: #f4f4f5;
}

.skip-compress-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #18181b;
    cursor: pointer;
}


/* Ads */

/* Modal Styles */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 12px;
    border-radius: 10px;
    width: 95%;
    max-width: 800px;
    max-height: 95vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.modal-image-container {
    width: 100%;
    text-align: center;
    background: #fafaf9;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    margin-bottom: 8px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.modal-image-container img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    transition: width 0.1s, max-width 0.1s, max-height 0.1s;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2rem;
    color: #27272a;
}

.modal-desc {
    font-size: 0.85rem;
    color: #71717a;
    margin-bottom: 20px;
    line-height: 1.4;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 50;
    transition: all 0.2s ease;
}

.close-modal:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.ad-bottom {
    margin-top: 40px;
    margin-bottom: 20px;
}

.ad-placeholder {
    display: inline-block;
    width: 100%;
    max-width: 728px;
    height: 90px;
    background-color: #f4f4f5;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    color: #a1a1aa;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.ad-placeholder p {
    margin: 0;
}

/* FAQ */
.faq-area {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 35px;
    margin-bottom: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.faq-area h2 {
    font-size: 1.2rem;
    border-bottom: 1px solid #e4e4e7;
    padding-bottom: 12px;
    margin-bottom: 25px;
    color: #18181b;
    font-weight: 500;
}

.faq-area dt {
    font-weight: 500;
    color: #27272a;
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.faq-area dd {
    margin-bottom: 25px;
    color: #52525b;
    font-size: 0.95rem;
    line-height: 1.7;
    padding-left: 15px;
    border-left: 2px solid #e4e4e7;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: #71717a;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }
    .preview-area, .settings-area {
        width: 100%;
    }

    /* モーダル: モバイル対応 */
    .modal-overlay {
        align-items: flex-start;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 0;
    }
    .modal-overlay > .modal-content {
        max-height: none;
        width: 98vw;
        margin: 0 auto;
        border-radius: 10px;
    }
    .modal-image-container {
        max-height: none;
    }
    .modal-image-container img {
        max-height: 40vh;
    }
    .modal-close {
        top: 4px;
        right: 4px;
    }

    /* 設定モーダル: モバイル対応 */
    .modal-content {
        max-height: none;
        width: 96%;
    }
}

/* ===== プレビューモーダル 詳細/一覧 切替タブ ===== */
.modal-view-tab {
    background: #f4f4f5;
    color: #71717a;
    border: 1px solid #e4e4e7;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.modal-view-tab:hover {
    background: #e4e4e7;
}
.modal-view-tab.active {
    background: #18181b;
    color: #fff;
    border-color: #18181b;
}

/* ===== インライングリッド: セクション見出し ===== */
/* ===== ファイル構成チップ ===== */
.breakdown-chip {
    display: inline;
    font-size: 0.78rem;
    font-weight: 400;
    color: #a1a1aa;
    white-space: nowrap;
}

/* ===== 画像選択アコーディオン ===== */
.img-accordion {
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 6px;
}
.img-accordion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: #fafaf9;
    user-select: none;
}
.img-accordion-arrow {
    display: none;
}
.img-accordion-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #3f3f46;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.img-accordion-count {
    font-size: 0.78rem;
    color: #52525b;
    font-weight: 500;
    white-space: nowrap;
}
.img-accordion-size {
    font-weight: 400;
    color: #71717a;
    font-size: 0.78rem;
    margin-left: 4px;
}
.img-accordion-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.img-accordion-del {
    color: #a1a1aa;
    font-size: 0.75rem;
    padding: 2px 6px;
    line-height: 1;
}
.img-accordion-del:hover {
    color: #ef4444;
    background: #fef2f2;
}
.img-accordion-body {
    display: block;
    border-top: 1px solid #e4e4e7;
}
.inline-grid-group {
    max-height: none;
    overflow-y: visible;
    margin-bottom: 0;
    border: none;
    border-radius: 0;
}

/* ===== 左右分割ビュー ===== */
.split-pane {
    display: flex;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    overflow: hidden;
    height: 420px;
}
.split-pane-filelist {
    width: 200px;
    min-width: 160px;
    border-right: 1px solid #e4e4e7;
    overflow-y: auto;
    background: #fafaf9;
    flex-shrink: 0;
}
.split-pane-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px;
    font-size: 0.8rem;
    color: #3f3f46;
    cursor: pointer;
    border-bottom: 1px solid #f4f4f5;
    user-select: none;
    transition: background 0.12s;
}
.split-pane-file:last-child {
    border-bottom: none;
}
.split-pane-file:hover {
    background: #f0f0ee;
}
.split-pane-file.active {
    background: #fff;
    box-shadow: inset 3px 0 0 #3b82f6;
    font-weight: 500;
}
.split-pane-file-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.split-pane-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.split-pane-file-count {
    font-size: 0.7rem;
    color: #a1a1aa;
    white-space: nowrap;
}
.split-pane-file-del {
    font-size: 0.7rem;
    color: #a1a1aa;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.12s;
}
.split-pane-file:hover .split-pane-file-del {
    opacity: 1;
}
.split-pane-file-del:hover {
    color: #ef4444;
    background: #fef2f2;
}
.split-pane-thumbs {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: #fff;
}
.split-pane-single {
    flex-direction: column;
}
.split-pane-single .split-pane-filelist {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid #e4e4e7;
    overflow-y: visible;
    display: flex;
    align-items: center;
    padding: 0;
}
.split-pane-single .split-pane-file {
    flex: 1;
    border-bottom: none;
    padding: 8px 12px;
    cursor: default;
    background: #fafaf9;
}
.split-pane-single .split-pane-file:hover {
    background: #fafaf9;
}
.split-pane-thumbs .modal-grid-container {
    max-height: none;
    overflow-y: visible;
    border: none;
    border-radius: 0;
    background: transparent;
}

/* ===== 一覧ビュー: 縦グリッド ===== */
.modal-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 8px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px 4px 10px 4px;
    background: #fafaf9;
    border-radius: 8px;
    border: 1px solid #e4e4e7;
}

/* セクション見出し（PPT/PDFのページ番号などのラベル） */
.modal-grid-section-title {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    font-weight: 500;
    color: #52525b;
    padding: 6px 4px 2px 4px;
    letter-spacing: 0.03em;
    border-bottom: 1px solid #e4e4e7;
    margin-bottom: 2px;
}

/* サムネイルセル */
.modal-grid-cell {
    position: relative;
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    padding: 5px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-grid-cell:hover {
    border-color: #a1a1aa;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.modal-grid-cell.skipped {
    opacity: 0.55;
}
.modal-grid-cell.skipped .modal-grid-thumb {
    filter: grayscale(0.4);
}

.modal-grid-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 3px;
    background: #f4f4f5;
    display: block;
}

.modal-grid-cell-label {
    font-size: 0.68rem;
    color: #3f3f46;
    margin: 3px 0 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.modal-grid-cell-size {
    font-size: 0.65rem;
    color: #71717a;
    margin-top: 1px;
}

/* チェックボックス（左上に絶対配置） */
.modal-grid-check {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 16px;
    height: 16px;
    accent-color: #18181b;
    cursor: pointer;
    z-index: 2;
    background: #fff;
    border-radius: 2px;
}

/* サムネがロードされていない時のスケルトン */
.modal-grid-thumb.loading {
    background: linear-gradient(90deg, #f4f4f5 0%, #e4e4e7 50%, #f4f4f5 100%);
    background-size: 200% 100%;
    animation: modal-grid-shimmer 1.4s infinite;
}
@keyframes modal-grid-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.modal-grid-bulk-btn {
    background: transparent;
    border: 1px solid #d4d4d8;
    color: #52525b;
    padding: 4px 10px;
    font-size: 0.72rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
.modal-grid-bulk-btn:hover {
    background: #f4f4f5;
    border-color: #a1a1aa;
}

@media (max-width: 640px) {
    .modal-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        max-height: 60vh;
        gap: 6px;
    }
    .modal-grid-cell { padding: 4px; }
    .modal-grid-check { top: 6px; left: 6px; width: 14px; height: 14px; }
    .modal-grid-cell-label { font-size: 0.62rem; }
    .modal-view-tab { padding: 5px 12px; font-size: 0.72rem; }
}

/* ===== プレビューモーダル ===== */
.preview-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s;
    padding: 16px;
}
.preview-modal-overlay.visible { opacity: 1; pointer-events: auto; }
.preview-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #e4e4e7;
    flex-shrink: 0;
}
.preview-modal-title {
    font-size: 0.85rem;
    color: #3f3f46;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 8px;
}
.preview-modal-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.preview-modal-nav button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #71717a;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.12s;
}
.preview-modal-nav button:hover { background: #f4f4f5; color: #3f3f46; }
.preview-modal-nav button:disabled { opacity: 0.3; cursor: default; }
.preview-modal-close {
    margin-left: 8px;
}
.preview-modal-image-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f4f5;
    position: relative;
    min-height: 200px;
    overflow: hidden;
}
.preview-modal-image-area img {
    max-width: 100%;
    max-height: 58vh;
    object-fit: contain;
    display: block;
}
.preview-modal-size-badge {
    position: absolute;
    bottom: 10px;
    right: 12px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    pointer-events: none;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.preview-modal-loading {
    color: #a1a1aa;
    font-size: 0.85rem;
}
.preview-modal-spinner {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(244, 244, 245, 0.6);
    z-index: 5;
}
.preview-modal-spinner.active {
    display: flex;
}
.preview-modal-spinner::after {
    content: '';
    width: 28px;
    height: 28px;
    border: 2.5px solid #d4d4d8;
    border-top-color: #18181b;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.preview-modal-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-top: 1px solid #e4e4e7;
    flex-shrink: 0;
}
.preview-modal-settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 480px;
}
.preview-modal-quality {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.preview-modal-quality label,
.preview-modal-resize label {
    font-size: 0.75rem;
    color: #52525b;
    font-weight: 600;
    white-space: nowrap;
}
.preview-modal-quality input[type="range"] {
    flex: 1;
    min-width: 80px;
    accent-color: #18181b;
}
.preview-modal-quality-val {
    font-size: 0.78rem;
    font-weight: 600;
    color: #18181b;
    min-width: 28px;
    text-align: right;
}
.preview-modal-resize {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.preview-modal-resize-select {
    font-size: 0.78rem;
    padding: 4px 8px;
    border: 1px solid #a1a1aa;
    border-radius: 5px;
    background: #fff;
    color: #18181b;
    cursor: pointer;
    font-weight: 500;
}
.preview-modal-apply-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.preview-modal-apply-label {
    font-size: 0.72rem;
    color: #71717a;
    white-space: nowrap;
    font-weight: 500;
}
.preview-modal-apply {
    display: flex;
    gap: 0;
}
.preview-modal-apply button {
    font-size: 0.72rem;
    padding: 4px 10px;
    border: 1px solid #d4d4d8;
    background: #fff;
    color: #71717a;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.preview-modal-apply button:first-child {
    border-radius: 6px 0 0 6px;
}
.preview-modal-apply button:last-child {
    border-radius: 0 6px 6px 0;
}
.preview-modal-apply button:not(:first-child) {
    border-left: none;
}
.preview-modal-apply button.active {
    background: #18181b;
    color: #fff;
    border-color: #18181b;
}
.preview-modal-apply button.active + button {
    border-left: 1px solid #18181b;
}
.preview-modal-apply button:hover:not(.active) {
    background: #f4f4f5;
    color: #3f3f46;
}
.preview-modal-toast {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #27272a;
    color: #fff;
    font-size: 0.78rem;
    padding: 6px 16px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
}
.preview-modal-toast.show { opacity: 1; }

/* サムネイルにルーペアイコン（常時表示・右上） */
.modal-grid-cell .thumb-zoom-icon {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: none;
    z-index: 1;
}
.modal-grid-cell .thumb-zoom-icon svg {
    width: 11px;
    height: 11px;
    stroke: #fff;
    stroke-width: 2.5;
    fill: none;
}
.modal-grid-cell:hover .thumb-zoom-icon {
    opacity: 1;
    transform: scale(1.2);
}

@media (max-width: 640px) {
    .preview-modal { max-width: 100%; border-radius: 8px; }
    .preview-modal-image-area img { max-height: 45vh; }
    .preview-modal-toolbar { gap: 8px; padding: 8px 12px; }
    .preview-modal-apply button { font-size: 0.68rem; padding: 4px 8px; }
}
