.mobile-gen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f5f5;
    z-index: 9999;
    flex-direction: column;
    overscroll-behavior: none;
    overflow: hidden;
}

.mobile-gen-overlay.active {
    display: flex;
}

.mobile-gen-overlay .gen-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    min-height: 48px;
}

.mobile-gen-overlay .gen-top-left {
    display: flex;
    align-items: center;
}

.mobile-gen-overlay .gen-top-right {
    display: none;
    align-items: center;
    gap: 8px;
}

.mobile-gen-overlay .gen-top-right.visible {
    display: flex;
}

.mobile-gen-overlay .gen-back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    font-size: 15px;
    color: #333;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 8px;
}

.mobile-gen-overlay .gen-back-btn:active {
    background: #f0f0f0;
}

.mobile-gen-overlay .gen-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    color: #555;
    font-size: 15px;
    cursor: pointer;
}

.mobile-gen-overlay .gen-icon-btn:active {
    background: #e8e8e8;
}

.mobile-gen-overlay .gen-icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.mobile-gen-overlay .gen-download-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #333;
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.mobile-gen-overlay .gen-download-btn:active {
    background: #555;
}

.mobile-gen-overlay .gen-image-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
    position: relative;
}

.mobile-gen-overlay .gen-canvas-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mobile-gen-overlay .gen-canvas-wrap.visible {
    display: flex;
}

.mobile-gen-overlay .gen-main-canvas {
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    touch-action: none;
    transform-origin: center center;
}

.mobile-gen-overlay .gen-spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.mobile-gen-overlay .gen-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #e0e0e0;
    border-top-color: #555;
    border-radius: 50%;
    animation: mobileGenSpin 0.8s linear infinite;
}

.mobile-gen-overlay .gen-progress-text {
    font-size: 15px;
    color: #888;
    font-weight: 500;
}

@keyframes mobileGenSpin {
    to { transform: rotate(360deg); }
}

.mobile-gen-overlay .gen-tooltip {
    display: none;
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 2;
    opacity: 0.85;
}

.mobile-gen-overlay .gen-tooltip.visible {
    display: block;
}

.mobile-gen-overlay .gen-draw-tools {
    display: none;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border-radius: 20px;
    padding: 4px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    z-index: 2;
    gap: 2px;
    align-items: center;
}

.mobile-gen-overlay .gen-draw-tools.visible {
    display: flex;
}

.mobile-gen-overlay .gen-tool-divider {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 2px;
}

.mobile-gen-overlay .gen-draw-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: none;
    border-radius: 16px;
    color: #555;
    font-size: 14px;
    cursor: pointer;
}

.mobile-gen-overlay .gen-draw-tool-btn.active {
    background: #333;
    color: #fff;
}

.mobile-gen-overlay .gen-draw-tool-btn:active {
    background: #e0e0e0;
}

.mobile-gen-overlay .gen-draw-tool-btn.active:active {
    background: #444;
}

.mobile-gen-overlay .gen-bottom-panel {
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    flex-shrink: 0;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
}

.mobile-gen-overlay .gen-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.mobile-gen-overlay .gen-input {
    flex: 1;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    background: #fafafa;
    min-height: 42px;
    resize: none;
}

.mobile-gen-overlay .gen-input:focus {
    border-color: #aaa;
    background: #fff;
}

.mobile-gen-overlay .gen-regen-btn {
    background: #222;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-gen-overlay .gen-regen-btn:active {
    background: #444;
}

.mobile-gen-overlay .gen-regen-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

.mobile-gen-overlay .gen-progress-bar-wrap {
    height: 3px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.mobile-gen-overlay .gen-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #555, #333);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.mobile-gen-overlay .gen-status-text {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-bottom: 8px;
}

.mobile-gen-overlay #genKonvaContainer {
    cursor: none;
    border-radius: 10px;
    overflow: hidden;
}

.mobile-gen-overlay #genKonvaContainer canvas {
    border-radius: 10px;
}

.mobile-gen-overlay .gen-brush-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    vertical-align: middle;
}

.mobile-gen-overlay .gen-brush-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #333;
    cursor: pointer;
}

.mobile-gen-overlay .gen-brush-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #333;
    cursor: pointer;
    border: none;
}

.mobile-edit-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 999;
    align-items: center;
    gap: 6px;
    background: #222;
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 28px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mobile-edit-fab:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mobile-edit-fab i {
    font-size: 13px;
}

@media (min-width: 769px) {
    .mobile-gen-overlay {
        display: none !important;
    }
    .mobile-edit-fab {
        display: none !important;
    }
}
