
.inpaint-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    background: var(--bg-color, #0b0f19);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-normal) var(--ease-standard);
    will-change: opacity;
    -webkit-tap-highlight-color: transparent;
}

.inpaint-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.inp-canvas-area {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    background: var(--bg-color, #0b0f19);
    padding: 16px;
}

.inp-image-frame {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color, #2a2f3d);
    border-radius: 20px;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    flex-shrink: 0;
}

.inp-base-img {
    display: none;
    width: 100%;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    border-radius: 14px;
    user-select: none;
    position: relative;
}

#inp-mask-canvas {
    position: absolute;
    top: 6px;
    left: 6px;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

#inp-display-canvas {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    cursor: none;
    border-radius: 14px;
}

.inp-brush-cursor {
    position: fixed;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    z-index: 100002;
    display: none;
    transform: none;
    mix-blend-mode: difference;
    transition: border-color 0.15s, border-radius 0.15s;
}

.inp-bottom-area {
    flex-shrink: 0;
    background: linear-gradient(to top, var(--panel-color, #131722) 50%, transparent);
    padding: 24px 12px 8px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inp-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.inp-toolbar::-webkit-scrollbar { display: none; }

.inp-tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background-color: var(--input-bg, #07090f);
    border: 1px solid var(--border-color, #2a2f3d);
    border-radius: 10px;
    padding: 6px 8px;
    min-width: 0;
    color: var(--text-sec, #8a92a6);
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease-standard),
                border-color var(--dur-fast) var(--ease-standard),
                transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    flex: 1 1 auto;
}

.inp-tool-btn:active {
    transform: scale(0.93);
}

.inp-tool-btn.active {
    color: var(--accent-color, #fceea7);
    border-color: rgba(252, 238, 167, 0.3);
}

.inp-tool-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.inp-tool-btn svg {
    flex-shrink: 0;
}

.inp-tool-btn[disabled] {
    opacity: 0.25;
    pointer-events: none;
}

.inp-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 2px;
    flex-shrink: 0;
}

.inp-apply-btn {
    width: 100%;
    height: 48px;
    background: var(--accent-color, #fceea7);
    color: var(--bg-color, #0b0f19);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.12s, background var(--dur-fast) var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
}

.inp-apply-btn:active {
    transform: scale(0.97);
    background: var(--accent-hover, #e0d293);
}

.inp-settings-panel {
    position: absolute;
    bottom: 140px;
    left: 12px;
    right: 12px;
    background: var(--panel-color, #131722);
    border: 1px solid var(--border-color, #2a2f3d);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 100;
    max-width: 360px;
    margin: 0 auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    animation: inp-panel-in 0.2s var(--ease-decelerate);
}

.inp-settings-panel.hidden,
.inp-size-panel.hidden {
    display: none;
}

@keyframes inp-panel-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.inp-settings-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inp-row-split {
    flex-direction: row;
    gap: 16px;
}

.inp-settings-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sec, #8a92a6);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.inp-color-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.inp-color-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    box-sizing: border-box;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.inp-color-dot:active { transform: scale(0.88); }

.inp-color-dot.active {
    border-color: var(--text-main, #fff);
    transform: scale(1.18);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.inp-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 24px;
    background: transparent;
    padding: 0 10px;
    background-size: 100% 4px;
    background-position: center;
    background-repeat: no-repeat;
    background-origin: content-box;
    background-clip: content-box;
    outline: none;
    cursor: pointer;
}

.inp-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--text-main, #fff);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.inp-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: transparent;
    border-radius: 2px;
}

.inp-checkbox-label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-main, #fff);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.inp-checkbox-label input[type="checkbox"] {
    accent-color: var(--accent-color, #fceea7);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.inp-pattern-row {
    display: flex;
    gap: 8px;
}

.inp-pattern-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color, #2a2f3d);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sec, #8a92a6);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    background: rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
}

.inp-pattern-btn[data-pattern="solid"] {
    background: rgba(255, 255, 255, 0.85);
    border-color: transparent;
}

.inp-pattern-btn.active {
    border-color: var(--accent-color, #fceea7);
    background: rgba(252, 238, 167, 0.12);
    color: var(--accent-color, #fceea7);
}

.inp-pattern-btn[data-pattern="solid"].active {
    background: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(252, 238, 167, 0.3);
}

.inp-pattern-btn:active { transform: scale(0.9); }

.inp-size-panel {
    position: absolute;
    bottom: 140px;
    left: 12px;
    background: var(--panel-color, #131722);
    border: 1px solid var(--border-color, #2a2f3d);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    min-width: 180px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    animation: inp-panel-in 0.2s var(--ease-decelerate);
}

.inp-size-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sec, #8a92a6);
    white-space: nowrap;
}

.inp-size-label b {
    color: var(--accent-color, #fceea7);
}

.inpaint-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--panel-color, #131722) 70%, transparent);
    z-index: 99999 !important;
    pointer-events: none;
    overflow: visible !important;
}

.inpaint-action-bar > * {
    pointer-events: auto;
}

.inp-bar-btn {
    background-color: var(--input-bg, #07090f);
    border: 1px solid var(--border-color, #2a2f3d);
    border-radius: 10px;
    color: var(--text-sec, #8a92a6);
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    transition: color var(--dur-fast) var(--ease-standard),
                border-color var(--dur-fast) var(--ease-standard),
                transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.inp-bar-btn:active {
    transform: scale(0.95);
}

.inp-bar-old:active,
.inp-bar-mask:active {
    color: var(--accent-color, #fceea7);
    border-color: rgba(252, 238, 167, 0.3);
}

.inp-bar-mask.active {
    color: var(--accent-color, #fceea7);
    border-color: rgba(252, 238, 167, 0.3);
}

.inp-bar-generate {
    flex: 1;
    height: 48px;
    background: var(--accent-color, #fceea7);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 0 20px;
    color: var(--bg-color, #0b0f19);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s, background var(--dur-fast) var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
    text-align: center;
}

.inp-bar-generate:active {
    transform: scale(0.97);
    background: var(--accent-hover, #e0d293);
}

.generate-btn.inpaint-mode {
    background: var(--accent-color, #fceea7) !important;
}
