@charset "UTF-8";

/* --- 背景透過ツール専用 カプセル化CSS --- */
.tool-bg-remover {
    /* 固有の変数を定義 */
    --surface: #131c30;
    --surface-alt: #1c2741;
    --border: #1f2e4a;
    --border-light: #2a3a5a;
    --text: #d4dceb;
    --text-dim: #7d8ba2;
    --accent: #3aaeff;
    --accent-light: rgba(58, 174, 255, 0.12);
    --accent-glow: rgba(58, 174, 255, 0.28);
    --success: #3ddca3;
    --danger: #ff6b8a;
    --checker1: #c6c6c6;
    --checker2: #ffffff;

    /* bodyに代わるコンテナ自体の設定 */
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    font-family: "M PLUS 1", sans-serif;
}

.tool-bg-remover .tool-header {
    text-align: center;
    padding: 44px 20px 20px;
}

.tool-bg-remover .tool-header h1 {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 900;
    letter-spacing: -0.02em;
}

.tool-bg-remover .tool-header h1 span {
    background: linear-gradient(135deg, var(--accent), #cc5de8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tool-bg-remover .tool-header p {
    margin-top: 8px;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 300;
    line-height: 1.7;
}

/* 共通コンテナとの競合を避けるためのアプリ用コンテナ */
.tool-bg-remover .app-container {
    width: 100%;
    max-width: 800px;
    padding: 0 16px 80px;
    margin: 0 auto;
    flex: 1;
}

.tool-bg-remover .drop-zone {
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 44px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    background: var(--surface);
}

.tool-bg-remover .drop-zone:hover,
.tool-bg-remover .drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.tool-bg-remover .drop-zone-icon {
    font-size: 2.6rem;
    margin-bottom: 12px;
    display: block;
}

.tool-bg-remover .drop-zone-text {
    font-size: 0.92rem;
    color: var(--text-dim);
    line-height: 1.7;
}

.tool-bg-remover .drop-zone-text strong {
    color: var(--accent);
    font-weight: 700;
}

.tool-bg-remover #fileInput {
    display: none;
}

/* Editor */
.tool-bg-remover .editor {
    display: none;
    margin-top: 16px;
    animation: fadeUp 0.3s ease;
}

.tool-bg-remover .editor.show {
    display: block;
}

.tool-bg-remover .toolbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.tool-bg-remover .tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-bg-remover .tool-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 500;
    white-space: nowrap;
}

.tool-bg-remover .tool-slider {
    width: 100px;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--surface-alt);
    outline: none;
    cursor: pointer;
}

.tool-bg-remover .tool-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.tool-bg-remover .tool-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 28px;
    font-variant-numeric: tabular-nums;
}

.tool-bg-remover .tool-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-alt);
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tool-bg-remover .tool-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tool-bg-remover .tool-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.tool-bg-remover .tool-btn.primary:hover {
    opacity: 0.9;
}

.tool-bg-remover .color-preview {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border-light);
    flex-shrink: 0;
}

.tool-bg-remover .hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    text-align: center;
    margin-bottom: 10px;
    padding: 8px;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Canvas Area */
.tool-bg-remover .canvas-wrapper {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    height: 60vh;
    min-height: 200px;
}

.tool-bg-remover .canvas-scroller {
    width: 100%;
    height: 100%;
    overflow: auto;
    cursor: crosshair;
    position: relative;
}

.tool-bg-remover .canvas-scroller.panning {
    cursor: grab;
}

.tool-bg-remover .canvas-scroller.panning:active {
    cursor: grabbing;
}

.tool-bg-remover .canvas-container {
    display: inline-block;
}

.tool-bg-remover #mainCanvas {
    display: block;
    cursor: crosshair;
    background-color: var(--checker2);
    background-image:
        linear-gradient(45deg,
            var(--checker1) 25%,
            transparent 25%,
            transparent 75%,
            var(--checker1) 75%),
        linear-gradient(45deg,
            var(--checker1) 25%,
            transparent 25%,
            transparent 75%,
            var(--checker1) 75%);
    background-size: 12px 12px;
    background-position:
        0 0,
        6px 6px;
}

.tool-bg-remover .zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-bg-remover .zoom-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-alt);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1;
}

.tool-bg-remover .zoom-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tool-bg-remover .zoom-level {
    font-size: 0.78rem;
    color: var(--text-dim);
    min-width: 40px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.tool-bg-remover .zoom-level:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.tool-bg-remover .zoom-input {
    width: 52px;
    font-size: 0.78rem;
    font-family: inherit;
    text-align: center;
    background: var(--surface-alt);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--text);
    padding: 2px 4px;
    outline: none;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}

.tool-bg-remover .zoom-input::-webkit-outer-spin-button,
.tool-bg-remover .zoom-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Result */
.tool-bg-remover .result-area {
    display: none;
    margin-top: 12px;
    animation: fadeUp 0.3s ease;
}

.tool-bg-remover .result-area.show {
    display: block;
}

.tool-bg-remover .result-bar {
    background: var(--surface);
    border: 1px solid var(--success);
    border-radius: 10px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.tool-bg-remover .result-info {
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 500;
}

.tool-bg-remover .result-actions {
    display: flex;
    gap: 8px;
}

.tool-bg-remover .error-msg {
    display: none;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--danger);
    border-radius: 10px;
    padding: 14px 18px;
    margin-top: 12px;
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
}

.tool-bg-remover .error-msg.show {
    display: block;
    animation: fadeUp 0.3s ease;
}

.tool-bg-remover .features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 32px;
}

.tool-bg-remover .feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
}

.tool-bg-remover .feature:hover {
    border-color: var(--accent);
}

.tool-bg-remover .feature-icon {
    font-size: 1.2rem;
    margin-bottom: 5px;
    display: block;
}

.tool-bg-remover .feature-text {
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.5;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .tool-bg-remover .toolbar {
        gap: 8px;
        padding: 12px;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .tool-bg-remover .toolbar>div[style] {
        display: none;
    }

    .tool-bg-remover .tool-group {
        flex: 1 1 auto;
        min-width: 0;
    }

    .tool-bg-remover .tool-slider {
        width: 60px;
        flex: 1;
    }

    .tool-bg-remover .zoom-controls {
        order: 10;
        width: 100%;
        justify-content: center;
        padding-top: 4px;
        border-top: 1px solid var(--border);
    }

    .tool-bg-remover .tool-btn {
        font-size: 0.72rem;
        padding: 6px 10px;
    }

    .tool-bg-remover .result-actions {
        flex-direction: column;
        width: 100%;
    }

    .tool-bg-remover .result-actions .tool-btn,
    .tool-bg-remover .result-actions .tool-btn.primary {
        width: 100%;
        text-align: center;
    }

    .tool-bg-remover .result-bar {
        flex-direction: column;
        text-align: center;
    }

    .tool-bg-remover .canvas-wrapper {
        height: 50vh;
    }

    .tool-bg-remover .hint {
        font-size: 0.72rem;
    }

    .tool-bg-remover .tool-header {
        padding: 30px 16px 14px;
    }
}