/* ===== Canvasラッパー ===== */
.canvas-wrapper {
    position: relative;
    display: inline-block;
    margin: auto;
}

/* ===== 選択範囲オーバーレイ ===== */
.selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.selection-box {
    position: absolute;
    border: 2px solid var(--primary-color);
    background: rgba(255, 107, 157, 0.1);
    pointer-events: all;
    cursor: move;
}

.selection-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border: 2px solid white;
    border-radius: 50%;
    pointer-events: all;
    z-index: 11;
}

.selection-handle:hover {
    background: #FF5687;
    transform: scale(1.2);
}

/* ハンドル位置 */
.handle-nw { top: -6px; left: -6px; cursor: nw-resize; }
.handle-ne { top: -6px; right: -6px; cursor: ne-resize; }
.handle-sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.handle-se { bottom: -6px; right: -6px; cursor: se-resize; }
.handle-n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.handle-s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.handle-w { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }
.handle-e { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }

/* ===== ツール設定パネル ===== */
.tool-settings {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    padding: 1.5rem;
    display: none;
    border: 1px solid var(--border-color);
}

.tool-settings.active {
    display: block;
}

.tool-setting-panel {
    display: none;
}

.tool-setting-panel.active {
    display: block;
}

.setting-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    border-bottom: 1px solid #D0D0D0;
    padding-bottom: 0.5rem;
}

.setting-description {
    font-size: 0.9rem;
    color: #000000;
    margin-bottom: 1rem;
    line-height: 1.4;
    background: #FFF5F8;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid #FFD0E0;
}

.setting-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ボタンのアクティブ状態での文字色確保 */
.tool-btn.active .tool-text {
    color: white !important;
}

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

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.setting-input {
    width: 10%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: var(--transition);
}

.setting-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.setting-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.setting-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.setting-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* ===== スライダー ===== */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow-light);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow-light);
}

.slider-value {
    font-size: 0.9rem;
    color: var(--text-color);
    text-align: center;
    font-weight: 500;
}

/* ===== ダウンロード設定 ===== */
.download-settings {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    padding: 1.5rem;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 250px;
    z-index: 100;
    display: none;
}

.download-settings.active {
    display: block;
}

.format-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.format-option {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #888888;
    border-radius: var(--border-radius);
    background: #F0F0F0;
    cursor: pointer;
    text-align: center;
    font-size: 0.8rem;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    color: #000000;
}

.format-option:hover {
    border-color: var(--primary-dark);
    background: #FFE0EC;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.format-option.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-weight: 700;
}

.quality-setting {
    display: none;
}

.quality-setting.active {
    display: block;
}

/* ===== プレビューエリア ===== */
.preview-area {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #F8F9FA;
    border-radius: var(--border-radius);
    border: 1px solid #D0D0D0;
}

.preview-before,
.preview-after {
    flex: 1;
    text-align: center;
}

.preview-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.preview-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

/* ===== 情報表示 ===== */
.image-info {
    background: #F8F9FA;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    border: 1px solid #D0D0D0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    font-weight: 700;
    color: #000000;
}

.info-value {
    color: #000000;
    font-weight: 700;
}

/* ===== アニメーション ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ===== ツールチップ ===== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    margin-bottom: 0.5rem;
}

.tooltip:hover::after {
    opacity: 1;
}

/* ===== メッセージ表示 ===== */
.success-message,
.info-message,
.warning-message {
    position: fixed;
    top: 20px;
    right: 20px;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    z-index: 1001;
    max-width: 400px;
    min-width: 200px;
    animation: slideInRight 0.3s ease-out;
    transition: all 0.3s ease;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.success-message {
    background: #28A745;
}

.info-message {
    background: #17A2B8;
}

.warning-message {
    background: #FFC107;
    color: #212529;
}

.success-content,
.info-content,
.warning-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 100%;
}

.success-icon,
.info-icon,
.warning-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.success-text,
.info-text,
.warning-text {
    flex: 1;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.message-action {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: inherit;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
}

.message-action:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.message-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.message-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== プログレスバー ===== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ===== ローディング拡張 ===== */
.loading-progress {
    margin-top: 1.5rem;
    text-align: center;
}

.loading-progress .progress-bar {
    background: rgba(255, 255, 255, 0.3);
    margin: 0.5rem 0;
}

.loading-progress .progress-fill {
    background: white;
}

.progress-text {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.loading-cancel {
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.loading-cancel:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ===== 空の状態表示 ===== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #333333;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #000000;
}

.empty-description {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #333333;
    font-weight: 600;
}

/* ===== 中心トリミング専用スタイル ===== */
.center-crop-preview {
    position: absolute;
    border: 2px solid var(--secondary-color);
    background: rgba(78, 205, 196, 0.1);
    pointer-events: none;
    z-index: 9;
    border-radius: 4px;
}

.center-crop-preview::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--secondary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 2px white;
}

.center-crop-info {
    background: #F8F9FA;
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    border: 1px solid #D0D0D0;
}

.center-crop-dimensions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.center-crop-dimensions:last-child {
    margin-bottom: 0;
}

.dimension-label {
    font-weight: 700;
    color: #000000;
}

.dimension-value {
    color: #000000;
    font-family: monospace;
    font-weight: 700;
}

/* ===== リサイズ専用スタイル ===== */
.resize-mode-selector {
    margin-bottom: 1.5rem;
}

.mode-tabs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.mode-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #666666;
    background: #E8E8E8;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 700;
    color: #000000;
    outline: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mode-tab:hover {
    border-color: #333333;
    background: #D0D0D0;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.mode-tab.active {
    border-color: var(--primary-dark);
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.resize-mode-panel {
    display: none;
    margin-bottom: 1.5rem;
}

.resize-mode-panel.active {
    display: block;
}

.preset-sizes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.preset-size-option {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 2px solid #888888;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    background: #F0F0F0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preset-size-option:hover {
    border-color: var(--primary-dark);
    background: #FFE0EC;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.preset-size-option:has(input:checked) {
    border-color: var(--primary-dark);
    background: #FFB8D0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.preset-size-option input[type="checkbox"] {
    margin-right: 0.75rem;
    accent-color: var(--primary-color);
}

.preset-size-text {
    font-weight: 700;
    color: #000000;
    margin-right: 0.5rem;
}

.preset-size-desc {
    font-size: 0.75rem;
    color: #333333;
    margin-left: auto;
    font-weight: 600;
}

.resize-dimension-selector {
    margin-top: 1.5rem;
}

.dimension-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.dimension-option {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border: 2px solid #888888;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    background: #F0F0F0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    color: #000000;
}

.dimension-option:hover {
    border-color: var(--primary-dark);
    background: #FFE0EC;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
    color: var(--primary-dark);
}

.dimension-option:has(input:checked) {
    border-color: var(--primary-dark);
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-weight: 700;
}

.dimension-option input[type="radio"] {
    margin-right: 0.5rem;
    accent-color: var(--primary-color);
}

.custom-size-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

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

.custom-size-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: var(--transition);
    background: white;
}

.custom-size-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.custom-size-remove {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--danger-color, #DC3545);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-size-remove:hover {
    background: var(--danger-hover, #C82333);
    transform: scale(1.05);
}

.resize-preview-area {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #F8F9FA;
    border-radius: var(--border-radius);
    border: 1px solid #D0D0D0;
}

.resize-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.resize-preview-item {
    text-align: center;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #D0D0D0;
}

.resize-preview-image {
    max-width: 100%;
    max-height: 80px;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.resize-preview-size {
    font-size: 0.8rem;
    font-weight: 700;
    color: #000000;
}

.resize-preview-dims {
    font-size: 0.7rem;
    color: #333333;
    margin-top: 0.25rem;
    font-weight: 600;
}

.resize-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.resize-dimension {
    font-family: monospace;
    text-align: center;
}

.resize-dimension:invalid {
    border-color: #DC3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.resize-info {
    background: #F8F9FA;
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    border: 1px solid #D0D0D0;
}

/* リサイズ用フォーマット選択 */
.resize-format-selector {
    margin-bottom: 1.5rem;
}

.format-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.format-option-resize {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    border: 2px solid #888888;
    border-radius: var(--border-radius);
    background: #F0F0F0;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.format-option-resize:hover {
    border-color: var(--primary-dark);
    background: #FFE0EC;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.format-option-resize:has(input:checked) {
    border-color: var(--primary-dark);
    background: #FFB8D0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.format-option-resize input[type="radio"] {
    margin-bottom: 0.5rem;
    accent-color: var(--primary-color);
}

.format-option-resize .format-text {
    font-weight: 700;
    color: #000000;
    margin-bottom: 0.25rem;
}

.format-option-resize .format-desc {
    font-size: 0.75rem;
    color: #333333;
    font-weight: 600;
}

.resize-quality-setting {
    margin-top: 1rem;
    padding: 1rem;
    background: #FFF5F8;
    border-radius: var(--border-radius);
    border: 1px solid #FFD0E0;
}

.resize-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.resize-preview-item {
    text-align: center;
}

.resize-preview-title {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.resize-preview-canvas {
    max-width: 100%;
    max-height: 120px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
}

.resize-warning {
    background: #FFF3CD;
    border: 1px solid #FFEAA7;
    color: #856404;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: none;
}

.resize-warning.active {
    display: block;
}

.resize-warning-icon {
    margin-right: 0.5rem;
}
/* ==
=== ダウンロードダイアログ ===== */
.download-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-dialog.hidden {
    display: none;
}

.dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.dialog-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    animation: dialogSlideIn 0.3s ease-out;
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    background: #F9FAFB;
}

.dialog-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.dialog-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.dialog-close:hover {
    background: #E5E7EB;
    color: var(--text-color);
}

.dialog-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.download-option-group {
    margin-bottom: 24px;
}

.download-option-group:last-child {
    margin-bottom: 0;
}

.download-label {
    display: block;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.format-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.format-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.format-option:hover {
    border-color: var(--primary-color);
    background: rgba(255, 107, 107, 0.05);
}

.format-option input[type="radio"] {
    margin-right: 12px;
    accent-color: var(--primary-color);
}

.format-option input[type="radio"]:checked + .format-text {
    color: var(--primary-color);
    font-weight: 600;
}

.format-option:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background: rgba(255, 107, 107, 0.1);
}

.format-text {
    font-weight: 500;
    color: var(--text-color);
    margin-right: 8px;
}

.format-desc {
    font-size: 0.85rem;
    color: #333333;
    font-weight: 600;
}

.quality-control {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.quality-slider {
    flex: 1;
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    outline: none;
    appearance: none;
}

.quality-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.quality-value {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
}

.quality-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quality-preset {
    padding: 6px 12px;
    border: 2px solid #888888;
    background: #F0F0F0;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    color: #000000;
}

.quality-preset:hover {
    border-color: var(--primary-dark);
    background: #FFE0EC;
    color: var(--primary-dark);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.quality-preset.active {
    border-color: var(--primary-dark);
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-weight: 700;
}

.download-filename {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.download-filename:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.filename-preview {
    margin-top: 8px;
    padding: 8px 12px;
    background: #F3F4F6;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
}

.filename-text {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 600;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #E5E7EB;
    background: #F9FAFB;
}

.dialog-footer .btn {
    min-width: 100px;
}

/* タブレット対応 */
@media (min-width: 641px) and (max-width: 1024px) {
    .dialog-content {
        width: 85%;
        max-width: 500px;
    }
    
    .dialog-header,
    .dialog-body,
    .dialog-footer {
        padding: 24px;
    }
    
    .format-option {
        padding: 14px 18px;
        font-size: 1rem;
    }
    
    .quality-control {
        gap: 20px;
    }
    
    .quality-slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .quality-slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    
    .quality-preset {
        padding: 8px 16px;
        font-size: 0.9rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .download-filename {
        padding: 14px 18px;
        font-size: 1rem;
    }
    
    .dialog-footer .btn {
        min-width: 120px;
        padding: 12px 24px;
    }
}

/* モバイル対応 */
@media (max-width: 640px) {
    .dialog-content {
        width: 95%;
        margin: 20px;
    }
    
    .dialog-header,
    .dialog-body,
    .dialog-footer {
        padding: 16px;
    }
    
    .format-options {
        gap: 6px;
    }
    
    .format-option {
        padding: 10px 12px;
    }
    
    .quality-presets {
        gap: 6px;
    }
    
    .quality-preset {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    
    .dialog-footer {
        flex-direction: column;
    }
    
    .dialog-footer .btn {
        width: 100%;
    }
}

/* ===== タブレット専用コンポーネント最適化 ===== */
@media (pointer: coarse) and (min-width: 768px) {
    /* 選択ハンドルの最適化 */
    .selection-handle {
        width: 18px;
        height: 18px;
        border-width: 3px;
    }
    
    .handle-n, .handle-s {
        width: 28px;
        height: 18px;
    }
    
    .handle-w, .handle-e {
        width: 18px;
        height: 28px;
    }
    
    /* スライダーの最適化 */
    .slider {
        height: 8px;
    }
    
    .slider::-webkit-slider-thumb {
        width: 26px;
        height: 26px;
    }
    
    .slider::-moz-range-thumb {
        width: 26px;
        height: 26px;
    }
    
    /* ツール設定の最適化 */
    .setting-input {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 1rem;
    }
    
    .setting-checkbox input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }
    
    .setting-checkbox {
        min-height: 48px;
        padding: 8px;
    }
    
    /* メッセージの最適化 */
    .error-message,
    .success-message,
    .info-message,
    .warning-message {
        padding: 16px 20px;
        font-size: 1rem;
    }
    
    .error-close,
    .message-close {
        width: 32px;
        height: 32px;
        font-size: 1.4rem;
    }
}